导航hover延迟

 $(function(){

  var hoverTimer, outTimer;
        $(".nav li").hover(function () {
            var _this = $(this);
            clearTimeout(outTimer);
            hoverTimer = window.setTimeout(function () {
                _this.find('a').addClass("active");
                _this.find(".addnavul").stop(true, true).slideDown(500);
            },0);
        }, function () {
            clearTimeout(hoverTimer);
            $(this).find('a').removeClass("active");
            $(this).find(".addnavul").stop(true, true).slideUp(500);

        });
      


 })

 

posted @ 2019-09-29 09:00  2人4人  阅读(149)  评论(0编辑  收藏  举报