0
在下面的滾動功能因素,我想弄清楚我是如何通過一定數目的像素的晃過股利pg-selection
的底部(比方說15像素)。如何在附加的底部PX在一個窗口中滾動功能
像這樣:
我試圖修改`bottom_of_element變量的方式不同,但都沒有奏效。我想:
var bottom_of_element = $('#pg-selection').offset({bottom: 15}).top + $('#pg-selection').outerHeight();
和
var bottom_of_element = $('#pg-selection').offset().top.bottom 15 + $('#pg-selection').outerHeight();
有誰知道我需要做什麼?
我有以下滾動功能:
$(window).scroll(function() {
var top_of_element = $('#pg-selection').offset().top;
var bottom_of_element = $('#pg-selection').offset().top + $('#pg-selection').outerHeight();
var bottom_of_screen = $(window).scrollTop() + $(window).height();
if ((bottom_of_screen > top_of_element) && (bottom_of_screen < bottom_of_element)) {
console.log(" PG Showing");
$('#cal-selected-thumb').fadeIn(400);
}
else {
console.log(" PG Not Showing");
$('#cal-selected-thumb').fadeOut(400);
}
});
感謝您的幫助! – Paul