within scroll function below, trying figure out how can go past bottom of div pg-selection
number of px's (let's 15px).
like this:
i have tried modify `bottom_of_element variable in different ways, none have worked. tried:
var bottom_of_element = $('#pg-selection').offset({bottom: 15}).top + $('#pg-selection').outerheight();
and
var bottom_of_element = $('#pg-selection').offset().top.bottom 15 + $('#pg-selection').outerheight();
does know need do?
i have following scroll function:
$(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); } });
your code works fine, forgot '+' in second example of bottom_of_element example. i've tried , works charm:
var bottom_of_element = $('#pg-selection').offset().top + $('#pg-selection').outerheight() + 200;
Comments
Post a Comment