Javascript jquery不必要地加载内容
这是我的悬停图像的java脚本。当使用load()将as image替换为另一个图像时,悬停在正常工作。hoverout也可以从本质上恢复旧图像。但是就在hoverout jquery之后,再次将hoverin图像带回来。当我签入firebug时,我看到hoverin中的load()函数再次运行。只有load()函数,没有其他功能。为什么会这样?加载脚本是嵌入在html中还是什么?如果是这样,我如何删除它?我试图重新组装您的代码,这Javascript jquery不必要地加载内容,javascript,jquery,Javascript,Jquery,这是我的悬停图像的java脚本。当使用load()将as image替换为另一个图像时,悬停在正常工作。hoverout也可以从本质上恢复旧图像。但是就在hoverout jquery之后,再次将hoverin图像带回来。当我签入firebug时,我看到hoverin中的load()函数再次运行。只有load()函数,没有其他功能。为什么会这样?加载脚本是嵌入在html中还是什么?如果是这样,我如何删除它?我试图重新组装您的代码,这 $(函数(){ $(“.blue anim”).hover(
$(函数(){
$(“.blue anim”).hover(函数(){
$(“.blue动画”).load(”https://raw.githubusercontent.com/xxxmatko/xDev.RequireJs/master/README.md");
$(“.blue figcaption”)
.文本(“物理学”)
.removeClass('blue-figcaption'))
.addClass(“新标题”);
},函数(){
$(此)。加载(“https://raw.githubusercontent.com/xxxmatko/xDev.Boilerplates/master/README.md");
$(“.新标题”)
.文本(“过去”)
.removeClass('new-caption')
.addClass('blue-figcaption');
});
});代码>
。蓝色动画{
背景:蓝色;
宽度:600px;
高度:200px;
}
蓝色菲卡普顿酒店{
颜色:蓝色;
}
.新标题{
颜色:红色;
}
当您删除setTimeout
功能时,问题是否仍然存在?
$('.blue-anim').hover(function(){
setTimeout(function(){
$('.blue-anim').load('/web #physics')
}, 1000);
$('.bluefigcaption').text("Physics").removeClass('blue_figcaption').addClass('new_caption');
}, function(){
$('.blue-anim').load('/web #past');
$('.blue figcaption').text("Past").removeClass('new_caption').addClass('blue_figcaption');
}
);