Last active
December 25, 2015 07:29
-
-
Save rxnlabs/6939320 to your computer and use it in GitHub Desktop.
Javascript - Show Elements on page after a page scroll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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