【发布时间】:2013-06-21 19:35:00
【问题描述】:
我需要在鼠标悬停时扩展一个 div,这很好,但是当鼠标离开 div 时,它不会恢复正常
这里有一些我的文件http://jsfiddle.net/MyKnB/
$("#logo-expand").mouseenter(function() {
$(this).animate({
width: "56px;"
}, 300 );
});
$("#logo-expand").mouseleave(function() {
$(this).animate({
width: "170px"
}, 300 );
});
【问题讨论】:
-
$("#logo-expand").on('mouseenter mouseleave', function(e) {$(this).animate({width:(e.type=='mouseenter'?56:170)},300);});
标签: jquery mouseenter mouseleave