簡體   English   中英

滾動到特定位置后隱藏固定內容?

[英]Hide fixed content after scroll to specific position?

我使用這個 ( https://github.com/cheald/floatingFixed ) Javascript 在我的網站上創建社交分享欄。 它工作得很好,但當它滾動到頁面的頁腳時我不想顯示它。 這個怎么做? 這是我網站的頁面之一http://thedripple.com/1384/lg-optimus-g-launch-price/

非常簡單,因為您已經包含了 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
    }
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM