I have a floating menu (absolutely positioned) that remains in view when the user scrolls down the page, the problem is that I have a rather large footer, and if you scroll all the way to the bottom of the page, it will collide with the footer .
I just want it to stop talking 400px at the bottom of the page. Does anyone know if this can be done?
Here is the code:
var name = "#about";
var menuYloc = null;
$(document).ready(function(){
menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
$(window).scroll(function () {
var offset = menuYloc+$(document).scrollTop()+"px";
$(name).animate({top:offset},{duration:500,queue:false});
});
});
Thanks in advance!
Ryan
source
share