Created
August 4, 2015 17:44
-
-
Save fercocuzza/1e6e63a5edccc1f9da63 to your computer and use it in GitHub Desktop.
hide-div-on-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
$(window).scroll(function(){ | |
var threshold = 200; // number of pixels before bottom of page that you want to start fading | |
var op = (($(document).height() - $(window).height()) - $(window).scrollTop()) / threshold; | |
if( op <= 0 ){ | |
$("#thing-to-hide").hide(); | |
} else { | |
$("#thing-to-hide").show(); | |
} | |
$("#thing-to-hide").css("opacity", op ); | |
}); | |
/* | |
I´m trying to change this with no luck, I mean the same effect but to show the div on scroll. | |
Thank you | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment