如何阻止jquery位置div滚动页脚

时间:2013-10-15 00:52:47

标签: javascript jquery html css

我有一个简单的jquery脚本,用于帮助mydiv向下流动页面。它很棒!然而,它溢出了我怎么能阻止它,所以它不会溢出页脚?

HTML

<div id="follow">
    <div class="summaryTotal">
        <h3>Estimated Total </h3>           
        <h3 class="summary" data-price="0">$0</h3>
        <span class="small">Read more about our pricing here.</span>
    </div>
    <div class="well">
        <h3>Quote:</h3>
        <ul id="selections"></ul>
</div>
    <button type="submit" class="button-success">Book Now!</button>
    <a href="{{ URL::to('book/services') }}" class="button-error">Start over</a>
    <div class="seperator"></div>
</div>
<br />

<footer>blah vlah</footer>

jquery的

$(document).ready(function () {
    var speed = 1000;
    var current_top = parseInt( $('#follow').css('top') );
    $(window).scroll( function () {
        var top = $(window).scrollTop();
        $('#follow').css('top', top + current_top);
    });
});

CSS

#follow {
    position: absolute;
    right: 10px;
}   

0 个答案:

没有答案