Hide Fixed Element When Reached At The Bottom of Page
Wed Jan 03 2024 10:08:47 GMT+0000 (Coordinated Universal Time)
Saved by
@vishalsingh21
//fade out and hide a fixed element when you scroll to the bottom of the page (jQuery)
$(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 );
});
content_copyCOPY
Comments