0

この ( https://github.com/cheald/floatingFixed ) Javascript を使用して、サイトにソーシャル共有バーを作成しました。うまく機能していますが、ページのフッターにスクロールしたときに表示したくありません。これを行う方法?これが私のサイトのページの1つです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 に答える