码迷,mamicode.com
首页 > Web开发 > 详细

jquery hover延时

时间:2015-08-28 22:52:01      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:

 var timer;
    //绑定hover事件
    $(function () {
         $(".centercy img").hover(showPic, hidePic);
    });

    //显示图片
    function showPic() {
        var el = $(this),
                imgUrl = "url(‘" + el.attr("big-img") + "‘)";
        timer = setTimeout(function () { $("#photo").css("background-image", imgUrl).slideDown(200) }, 210);
    }
    //隐藏图片
    function hidePic() {
        clearTimeout(timer);
        $("#photo").hide();
    }

jquery hover延时

标签:

原文地址:http://www.cnblogs.com/pandabunny/p/3804156.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!