gpt4 book ai didi

javascript - 鼠标悬停在 div 上时应该加载 javascript 文件

转载 作者:行者123 更新时间:2023-11-28 20:05:37 25 4
gpt4 key购买 nike

我有一个div :

<div class="content"></div>

这个div仅当我将鼠标悬停在 div 上时才会出现.

我有一个script.js应该仅在悬停此 div 时加载并且不是默认情况下。这可能吗?

最佳答案

您可以使用 jQuery getScript 函数

$(function() { 
$(".content").hover(function() {
$.getScript( "script.js" );
});
});

http://api.jquery.com/jquery.getscript/

关于javascript - 鼠标悬停在 div 上时应该加载 javascript 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20880926/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com