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