Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Div visible only after scrolling to specific waypoint
var isVisible = false;
$('#id').click(function(){
$(window).scrollTop(0);
});
$(window).scroll(function(){
var shouldBeVisible = $(window).scrollTop()>500;
if (shouldBeVisible && !isVisible) {
isVisible = true;
$('#idr').show();
} else if (isVisible && !shouldBeVisible) {
isVisible = false;
$('#id').hide();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.