// 滚动动画 function animated(dom){ var offsettop = dom.offset().top; var scrolltop = $(window).scrolltop(); var windowheight = $(window).height()-150; if(scrolltop>(offsettop-windowheight)&&scrolltop<(offsettop)){ dom.addclass('cur'); } else if(scrolltop<(offsettop-windowheight)||scrolltop>(offsettop+200)){ dom.removeclass('cur'); } } $('.navmenu').click(function(){ $(this).toggleclass('on'); $(this).siblings('ul').toggleclass('slider'); }) $(".searchbox").click(function(){ $(this).addclass('on'); $(this).find("input[type='text']").focus(); }) $(".searchbox input[type='text']").blur(function(){ $(this).parent().removeclass('on'); }) var length_ = $(".floatnav li.n1 i div.qq_img").length; $(window).scroll(function (){ var oh=$(window).height(); if($(this).scrolltop() > oh/2) { $('.floatnav li.n4').fadein(); } else { $('.floatnav li.n4').fadeout(); } }); $('.floatnav li.n4 a').click(function(){ $("html, body").animate({ scrolltop: 0 }, 750); }); $(".floatnav li").each(function(){ var width_ = $(this).find("i").width()+60; $(this).hover(function(){ $(this).addclass("on"); $(this).find("i").stop().animate({"right":"0px"}); },function(){ $(this).removeclass("on"); $(this).find("i").stop().animate({"right":0-width_}); }) })