猿问

setTimeout与Mouseenter结合使用无效的解决方法

$(".item-holder").each(function(){

    $(this).bind("mouseenter", function(e) {

        e.preventDefault();

        var t = setTimeout(function(){

            $(this).find(".mindex-blog-meta").animate({

                left:"0"

            },500);

            $(this).find(".ret").animate({

                top:"60%"

            },600);

        });

    },300)

});


$(".item-holder").each(function(){

    $(this).bind("mouseleave", function(e) {

        e.preventDefault();

        clearTimeout(t);

        $(this).find(".mindex-blog-meta").animate({

            left:"-60%"

        },500);


        $(this).parent().find(".ret").animate({

            top:"100%"

        },600);

    });

});


人到中年有点甜
浏览 537回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答