0

我使用这个 ( https://github.com/cheald/floatingFixed ) Javascript 在我的网站上创建社交分享栏。它工作得很好,但我不想在它滚动到页脚时显示它。这该怎么做?这是我网站的一个页面http://thedripple.com/1384/lg-optimus-g-launch-price/

4

1 回答 1

2

非常简单,因为您已经包含了 jQuery:

$(window).scroll(function() { //when scrolled
    var flt = $(".floater");
    var offset = flt.offset().top + flt.height(); //get the current offset of the floater
    var footertop = $("#footer").offset().top; //and the footer's top offset
    if(offset > footertop) { //if you scrolled past the footer
        flt.hide(); //hide the sharing tab
    }
    else {
        flt.show(); //show it
    }
});
于 2012-09-18T18:53:53.283 回答