页汉堡包菜单上单击
问题描述:
我建立一个模板,在这里可以看到,当跳起来页面跳转。页汉堡包菜单上单击
这是我的js至今:
$(document).foundation();
$(document).ready(function(){
function carouselInit() {
if($('.single-project').length > 4 && !$('.slick-initialized').length) {
$('.single-item').slick({
responsive: [
{
breakpoint: 1024,
settings: 'unslick'
}]
});
}
else {
console.log('4');
}
}
$('.hamburger').on('click', function(){
if($('header').hasClass('fixed')){
$('header').removeClass('fixed').addClass('absolute');
$(this).toggleClass('open');
}
else {
$('header').removeClass('absolute').addClass('fixed');
$(this).toggleClass('open');
}
});
carouselInit();
var resizeId;
$(window).resize(function() {
clearTimeout(resizeId);
resizeId = setTimeout(carouselInit, 500);
});
});
当汉堡包图标的所有页面不应该跳起来一下。
答
这是使页面跳转的代码段:
// Elements with [data-toggle] will toggle a plugin that supports it when clicked.
$(document).on('click.zf.trigger', '[data-toggle]', function() {
triggers($(this), 'toggle');
});
当你点击它会触发id为“某物”的元素“toggle.zf.trigger”汉堡包菜单上。这进一步进入具有这段代码的公开功能:
if (this.options.forceTop) {
$('body').scrollTop(0);
}
猜猜它是做什么的? :)我只能假设将OffCanvas forceTop选项设置为false将会消除此行为。