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