开发者

jQuery superfish menu / hover on iPad, iPhone etc

开发者 https://www.devze.com 2023-03-17 02:57 出处:网络
I am using the jQuery Superfish plugin on a website I am working on. Works fine so far. Problem is: I have to optimize the site for mobile devices like iPad etc.

I am using the jQuery Superfish plugin on a website I am working on. Works fine so far.

Problem is: I have to optimize the site for mobile devices like iPad etc.

After I click开发者_高级运维 on a menu item the menu doesn't close itself as long as I click any other link on the page.

I have tried looking at the Superfish code and changing hover events to click events but without success.

I am not a pro when it comes to jQuery, so I would appreciate if anyone could help me out what I need to change to make this stuff work.


try this

//ipad and iphone fix
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
    $("ul.sf-menu").bind('click',function() {
        $('ul.sf-menu').hideSuperfishUl();
    });
}

just add this to you document.ready hope it will help..

0

精彩评论

暂无评论...
验证码 换一张
取 消