简体   繁体   English

jQuery的悬停菜单不适用于触摸

[英]Jquery hover menu not working for touch

I have a dropdown menu with 3 items. 我有一个包含3个项目的下拉菜单。 It uses jquery hoverIntent plugin and works perfectly on desktop browsers. 它使用jquery hoverIntent插件,可以在桌面浏览器上完美运行。 But when it comes to iPad/tablet, if I touch on any of the menu item, it just activates that menu item. 但是当涉及到iPad /平板电脑时,如果我触摸任何菜单项,它只会激活该菜单项。 It doesn't slides down. 它不会滑下来。 If I try to touch again on it, nothing happens. 如果我尝试再次触摸它,则什么也没有发生。 But when I click on the other menu item, it works fine. 但是,当我单击另一个菜单项时,它可以正常工作。 That menu slides down properly and after that every other menu item also works properly. 该菜单会正确向下滑动,然后其他所有菜单项也将正常运行。 (even the first one I touched). (甚至是我碰到的第一个)。 Can anybody please help me out with this issue? 有人可以帮我解决这个问题吗?

Hover is designed with the mind-set that the user is using a mouse and be able to move the pointer on top of the element without clicking!! 悬停的设计思路是用户使用鼠标,无需单击即可将指针移动到元素上方!!

the touch environment has no hover .... it is either you touch or you don't with your finger!! 触摸环境没有悬停..它是您触摸还是不用手指!

so you need to hack it .. 所以你需要破解它..

you can use jquery mobile which add a layer for touch event 您可以使用jQuery Mobile为触摸事件添加一层

you also need to specify custom html for touch event : 您还需要为触摸事件指定自定义html:

http://www.w3.org/TR/touch-events/ http://www.w3.org/TR/touch-events/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM