清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
HTML代码(即需要漂浮的广告): <div class="christmas_ad" style="width:155px; height:220px; position:absolute; top:250px; right:25px;"> <a href="javascript:void(0)" ><img src="/themes/mall/wowsai/topics/images/christmas_2012/christmasAcvance.png" border="0" /></a> </div> js代码:前提是必须要引入jquery文件 <script type="text/javascript"> $(function(){ $(window).scroll(function(){ var scrollTop = document.body.scrollTop || document.documentElement.scrollTop || 0; $(".christmas_ad").stop(); var scrollTop2 = (scrollTop+160) - $(".christmas_ad").position().top; if(scrollTop> 440){ $(".christmas_ad:not(:animated)").animate({top:"+="+scrollTop2+"px"},1000); }else{ $(".christmas_ad").css("top",370+"px"); } }) }) </script>