1

i've got a problem with a float jquery menu. Well, it works perfectly. But when the browser windows size changes it comes to a problem. When the windows is big enough it scrolls/slides perfectly but i want it in a small window to slide if the scroll-amount and the "top"-amount ist bigger than the windows-height. Because now, if the windows size ist too small the menu slides in a not visible area, e.g. in 1024x768.

Here's my code:

$float_speed=1500; //milliseconds
$float_easing="easeOutQuint";
$menu_fade_speed=500; //milliseconds
$closed_menu_opacity=0.75;


$fl_menu=$("#float_menu_left");
$fl_menu_menu=$("#fl_menu .menu");
$fl_menu_label=$("#fl_menu .label");

$(window).load(function() {
menuPosition=$('#float_menu_left').position().top;
FloatMenu();
$fl_menu.hover(
    function(){ //mouse over
        $fl_menu_label.fadeTo($menu_fade_speed, 1);
        $fl_menu_menu.fadeIn($menu_fade_speed);
    },
    function(){ //mouse out
        $fl_menu_label.fadeTo($menu_fade_speed, $closed_menu_opacity);
        $fl_menu_menu.fadeOut($menu_fade_speed);
    }
    );
});

$(window).scroll(function () {
FloatMenu();
});

    function FloatMenu(){
var scrollAmount=$(document).scrollTop();
var topAmount = $("#float_menu_left").css("top");
var newPosition=menuPosition+scrollAmount;
if($(window).height()<$fl_menu.height()+scrollAmount){
    $fl_menu.css("top",menuPosition);
} else {
    $fl_menu.stop().animate({top: newPosition}, $float_speed, $float_easing);
}
}

The last function is the important one and the one which makes the problems. Especially this part :

if($(window).height()<$fl_menu.height()+scrollAmount){
    $fl_menu.css("top",menuPosition);
} else {
    $fl_menu.stop().animate({top: newPosition}, $float_speed, $float_easing);
}

I hope you can help me, i've tried very hard, believe me.

Best regards

Daimoch
  • 11
  • 2

0 Answers0