Hi,

I've got this simple script to show a floating menu. I want it to stop about 100px from the bottom, thanks.

$(function(){
function moveFloatMenu() {
    var menuOffset = menuYloc.top + $(this).scrollTop() + "px";
    $('#floatMenu').animate({top:menuOffset},{duration:1200,queue:false});
}
menuYloc = $('#floatMenu').offset();
$(window).scroll(moveFloatMenu);
moveFloatMenu();

});

  • Thanks Matt, but that just pushed it up another 200px. Anyway, I found a solution from another Jquery plugin: http://plugins.jquery.com/project/stickyfloat Alvin Tan almost 7 years ago

1 answer

0
points

You should be able to just modify the var menuOffset to subtract the height of your footer + 100px or so.

For example, say the footer has a height: 100px, you could modify to be:

    var menuOffset = menuYloc.top + $(this).scrollTop() - 200 + "px";

You should be able to mess around with the amount you are subtracting to suit your needs.

Here's a quick example just to make sure I'm understanding what you're trying to do: http://pastebin.me/43955a489061d7bd27f1c1aecffc8e3f

Answered almost 7 years ago by Matt Crest