以下按预期工作,除了一件事......当它向下时我无法滚动菜单!对于我的生活,我无法弄清楚如何解决它:(
我猜它与固定位置有关,但如果我改变它,那么菜单将无法按预期工作(一直卡在顶部)。
这是jQuery
$(document).ready(function () {
var topMenu = $('#topMenu');
var topMenuItem = $('#topMenu ul li a');
var top = $('#top');
var menuTrigger = $('.menu-trigger');
var time = 350;
var easing = 'easeOutCirc';
topMenu.css({
'top': -(topMenu.height())
});
menuTrigger.on('click', function () {
if (top.hasClass('closed')) {
top.animate({
top: topMenu.height()
},
time,
easing);
top.removeClass('closed').addClass('open');
} else if(top.hasClass('open')) {
top.animate({
top: 0
},
time,
easing);
top.removeClass('open').addClass('closed');
};
});
topMenuItem.on('click', function () {
if (topMenu.offset().top == 0) {
top.animate({
top: 0
},
time,
easing);
};
});});