Answer the question
In order to leave comments, you need to log in
How to display an element on scroll and hide it for N pixels until the end of the page appears?
At the moment, the fixed element is displayed on scroll with this code:
$(document).ready(function() {
$(window).scroll(function() {
if ( $(this).scrollTop() > 600 ) {
$('#widget').fadeIn('fast');
} else {
$('#widget').fadeOut('fast');
}
});
});
Answer the question
In order to leave comments, you need to log in
600 is what?
That's right, copied and not understood code.
turns into... turns into... an elegant condition
var pixelN = 100;
if ( $(this).scrollTop() > $(this).height() - $('footer').height() - pixelN){...}
N pixels before the end of the page
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question