//鍔ㄦ€佽缃晶杈规爮婊氬姩 $(function () { var offset_top = $('.right_nav').offset().top; //鑾峰彇鍙充晶瀵艰埅璺濈椤堕儴鐨勯珮搴 var begin = 0, end = 0, timer = null; $('.right_nav li:last').hide(); //鍏堝皢鍥炲埌椤堕儴闅愯棌 $(window).scroll(function (evt) { clearInterval(timer); var scroll_top = $(window).scrollTop(); end = offset_top + scroll_top; scroll_top > 100 ? $('.right_nav li:last').fadeIn() : $('.right_nav li:last').fadeOut(); //婊氬姩璺濈鍒ゆ柇鏄惁鏄剧ず鍥炲埌椤堕儴 timer = setInterval(function () { //婊氬姩瀹氭椂鍣 begin = begin + (end - begin) * 0.2; if (Math.round(begin) === end) { clearInterval(timer); } }, 10); }); }); //鍙充晶瀵艰埅浼哥缉鏁堟灉 var right_nav = $(".right_nav"); var tempS; $(".right_nav").hover(function () { var thisObj = $(this); tempS = setTimeout(function () { thisObj.find("li").each(function (i) { var tA = $(this); setTimeout(function () { tA.animate({ right: "0" }, 200); }, 50 * i); }); }, 200); }, function () { if (tempS) { clearTimeout(tempS); } $(this).find("li").each(function (i) { var tA = $(this); setTimeout(function () { tA.animate({ right: "-70" }, 200, function () {}); }, 50 * i); }); }); //鍙充晶瀵艰埅鐐瑰嚮浜嬩欢 $(".right_nav li").each(function (i) { if (i == 0 || i == 1 || i == 2) { $(this).mouseover(function () { $(this).children(".hideBox").stop().fadeIn(); right_nav.css('overflow', 'visible') }); $(this).mouseout(function () { $(this).children(".hideBox").hide(); right_nav.css('overflow', 'hidden') }); } else if (i == 3) { $(this).click(function () { //location.href = 'https://www.baidu.com/'; }) } else if (i == 4) { $(this).click(function () { $('body,html').animate({ scrollTop: 0 }, 400); }) } })