网页右侧的漂浮广告代码,随滚动条滚动

2019PHP高薪工程师学习路线图....>>>

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>