开发者

Banner scroll with windows scroll but stop and not overflow the div?

Actually i want to stop the scroll the banner when the banner touch the bottom of the div Please help me ........ I am using this code

<script type="text/javascript">


    $(document).ready(function(){
    $(window).scroll(function(){
        if  ($(window).scrollTop() > $(".smartBannerIdentifier").offset({ scroll: false }).top){
           $(".bannercomehere").css("position", "fixed");
           $(".bannercomehere").css("top", "0");
        }

        if  ($(window).scrollTop() <= $(".smartBannerIdentifier").offset({ scroll: false }).top){
           $(".bannercomehere").css("position", "relative");
        开发者_高级运维   $(".bannercomehere").css("top", $(".smartBannerIdentifier").offset);
        }


        }); 


});
</script>


<div> 
<div class="smartBannerIdentifier"></div>//here we stop the scroll of the banner and its on the top
<div class="bannercomehere">

..................Here i call a Banner..............
</div>
</div>
</div>


$(document).ready(function()
        {
            $(window).scroll(function()
            {
                if ($(window).scrollTop() > $(".smartBannerIdentifier").offset().top)
                {
                    $(".bannercomehere").css("position", "fixed");
                    $(".bannercomehere").css("top", "0");
                }

                if ($(window).scrollTop() <= $(".smartBannerIdentifier").offset().top)
                {
                    $(".bannercomehere").css("position", "relative");
                    $(".bannercomehere").css("top", $(".smartBannerIdentifier").offset);
                }


            });


        });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜