基于触摸的设备上的下拉菜单 [英] Drop-down menu on touch based devices
本文介绍了基于触摸的设备上的下拉菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的网站上有这个导航栏,但它没有在我的 iPod touch 上下拉,我怀疑 iPhone 和 iPad 也是如此.这是其中一页
I have this navigation bar on my website and it doesn't drop down on my iPod touch, I suspect the same for iPhones and iPads. This is one of the pages
我想知道是否有任何快速修复来启用触摸/悬停.
I was wondering if there is any quick fix to enable the touch/hover.
推荐答案
如果你对iDevices感兴趣,那么你可以使用这个技巧:
If you are interested in iDevices, then you can use this trick:
#nav ul {
display: none;
/* Your styles */
}
#nav > li:hover ul {
display: block;
}
/* This is important */
#nav > li > a:hover {
color: #fff; /* You can set the same color or add other style.*/
}
如果一个元素有 :hover
事件,那么第一次点击 iOS 会渲染 :hover
,第二次点击会引发点击事件.
If an element has the :hover
event then the first tap iOS renders :hover
and the second tap raises the click event.
应该可以的.
附:最好为移动、触控和桌面制作不同的 UI 逻辑.
P.S. It's better to make different UI logic for mobile, touch and desktop.
这篇关于基于触摸的设备上的下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文