Skip to content

Instantly share code, notes, and snippets.

@rxnlabs
Last active December 25, 2015 07:29
Show Gist options
  • Save rxnlabs/6939320 to your computer and use it in GitHub Desktop.
Save rxnlabs/6939320 to your computer and use it in GitHub Desktop.
Javascript - Show Elements on page after a page scroll
var isVisible = false;
$(window).scroll(function(){
var shouldBeVisible = $(window).scrollTop()>200;
if (shouldBeVisible && !isVisible) {
isVisible = true;
$('#mybutton').show();
} else if (isVisible && !shouldBeVisible) {
isVisible = false;
$('#mybutton').hide();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment