/* 参数:绑定块类名,延迟时间,动画模式(1为只运行一次,默认为无限),自定义动画类名(默认为向上渐隐渐现) */ function fadeanim(_node,time,num,animclass){ $("body").append('
'); var topvalue = $(".fixed_top").offset().top; var btop = $(_node).offset().top - $(window).height(); var timeb = time > 2 ? time : 0; var numb = time < 2 ? time : 0; numb = num ? num : numb; var animclassb = "animtop"; if(typeof animclass == "string"){ animclassb = animclass; }else if(typeof time == "string"){ animclassb = time; }else if(typeof num == "string"){ animclassb = num; } if (client.browser.ie != 7) { function animfun(){ $(_node).addclass("animinto"); btop = $(_node).offset().top - $(window).height() + 100; if(topvalue > btop){ settimeout(function(){ $(_node).addclass(animclassb); },timeb) }else if(numb != 1){ $(_node).removeclass(animclassb); } } animfun(); $(window).scroll(function(){ topvalue = $(".fixed_top").offset().top; animfun(_node); }) } } /* 调用 fadeanim(".class",400,1,"animclass"); */