我使用的是Superfish v1.7.4。我需要在移动分辨率中禁用Superfish菜单效果。这是我的代码。
<ul class="nav">
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li class="dropdown">
<a href="#">Pages</a>
<ul class="dropdown-menu">
<li><a href="about-us.html">About Us</a></li>
<li><a href="about-me.html">About Me</a></li>
<li><a href="services.html">Services</a></li>
</ul>
</li>
<li><a href="contact.html">Contact</a></li>
</ul>
$(document).ready(function() {
var $this = this;
$this.checkSuperfish = function() {
if ($(window).width() >= 768) {
$('ul.nav').addClass('sf-menu');
$('.sf-menu').superfish({
animation: { height: 'show' },
delay: 500,
hoverClass: 'open',
speed: 'fast',
});
}
else {
$('ul.nav').removeClass('sf-menu');
$('ul.nav li').unbind();
$('ul.nav li ul').removeAttr('style');
$('.sf-menu').superfish({
animation: { height: 'show' },
delay: 500,
speed: 'fast',
});
}
}
$(window).on("resize", function() {
$this.checkSuperfish();
});
$this.checkSuperfish();
});
在这里我有一点问题。当低分辨率时,菜单仍然在鼠标悬停事件中打开。我想禁用菜单打开效果。这可能吗。谢谢。