【发布时间】:2013-03-22 19:46:45
【问题描述】:
更新:我已合并我的代码并尝试添加 if/else 语句。我还没有弄清楚如何在点击时忽略 mouseenter/mouseleave 函数
$('#storybtn').on({
mouseenter:function(){
$('#story')
.stop()
.animate({top:'405px'},'slow');
},
mouseleave:function(){
$('#story')
.stop()
.animate({top:'435px'},'slow');
},
click:function(){
var position = $('#story').css('top');
if (position>'10px'){
$('#story')
.stop()
.animate({top:'10px'},'slow');
}
else (position='10px'){
$('#story')
.stop()
.animate({top:'435px'},'slow');
}
}
});
【问题讨论】:
标签: jquery click hover if-statement