嗨,我的代码有什么问题:
当我将鼠标悬停在 #open 上时,#pull_down_content 应该从标题向下移动页面,当我离开 #open 时,它应该向上移动。但是,当我在页面加载后测试代码时,#pull_down_content 在我将鼠标悬停在屏幕上之前就向下移动了。
$(function() {
//Open on hover
$('#open').hover((function(){
$('#pull_down_content').animate({'top':'-0px'},1000);
})
//Close when not hovered
(function(){
$('#pull_down_content').animate({'top':'-340px'},1000);
})
});
);
尝试像下面这样修复你的函数,
$(function() {
$('#open').hover(function(){ //Open on hover
$('#pull_down_content').animate({'top':'-0px'},1000);
},
function(){ //Close when not hovered
$('#pull_down_content').animate({'top':'-340px'},1000);
});
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)