gpt4 book ai didi

CSS3 下拉菜单悬停不起作用

转载 作者:行者123 更新时间:2023-11-28 10:18:26 25 4
gpt4 key购买 nike

我的网站使用纯 CSS3 下拉菜单。问题是在触摸屏设备上查看网站时,某些具有悬停属性的菜单项不会自动下拉。

我怎样才能将其更改为,如果菜单项有悬停下拉菜单,在触摸屏设备中您必须触摸它,然后菜单将下拉到我们 PC 的其他地方,它仍将保持悬停效果。

只用CSS能做到吗?

最佳答案

您是否尝试过使用 aria-haspopup 在支持触摸的设备上模拟悬停

看看this article .

On a page element such as a menu, set the element's aria-haspopup property to "true". When an Internet Explorer 10 user on a touch-enabled device first taps the page element, the user's experience will be identical to that of a user who hovers over the element with a cursor.

虽然我不确定浏览器对此的支持是什么样的。

关于CSS3 下拉菜单悬停不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16140903/

25 4 0