2013-04-30 75 views

回答

2

最簡單的方法是使用position: fixed;將菜單放置在所需的位置,並在單擊菜單的某個元素時切換控制菜單高度的類。例如:

$(document).on('click', '.menu h4', function() { 
    $(this).parent().toggleClass('expanded'); 
}); 

http://jsfiddle.net/UZFuT/

+0

非常感謝我的朋友對您的幫助 – 2013-04-30 07:53:31

1

這裏是我的菜單在Casumo.com的快速變化,我togheter扔你:)

http://jsfiddle.net/q8X2d/5/

你可以做一些在滑動之前的計算也在菜單中:

$(".menu-wrapper").hover(function() { 
    var $menu = $(this).find(".menu"); 
    var menuHeight = $menu.outerHeight(); 
$menu.stop().animate({ top: -menuHeight }, 200); 
}, function() { 
    var $menu = $(this).find(".menu"); 
    $menu.stop().animate({ top: 0 }, 200); 
}); 

如果您需要更多的定製幫助,請通過我們的辦公室在Ta'Xbiex搖擺;)