什么是javascript onmousover / CSS的替代品:悬停在没有鼠标的移动设备上? [英] What is an alternative to javascript onmousover / CSS:hover for mobile devices that have no mouse?

查看:88
本文介绍了什么是javascript onmousover / CSS的替代品:悬停在没有鼠标的移动设备上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CodeProject.com上,我们在A标签上使用CSS :hover 伪类来获取菜单下拉列表。它很快,它不需要设置脚本,并且当Javascript未启用或可用时它可以工作。



但是,对于使用a的移动设备和打击垫触摸屏没有鼠标悬停或悬停事件,所以这个设计失败。



什么是不依赖Javascript的好替代品?



1.只是不显示菜单,只有链接转到包含菜单下拉列表中可能出现的选项的页面?



2.使用:active伪类并弄清楚如何使链接引用页面上的书签而不是页外链接?



3.对菜单中的每个项目使用SELECT控件和OPTION。一些移动设备对这些设备有很好的支持。



4.液氮?

On CodeProject.com we use CSS :hover pseudo-class on A tags for menu dropdowns. It's fast, it requires no script execution to set up, and it works when Javascript isn't enabled or available.

However, for mobile devices and pads that use a touchscreen there is no mouse over or hover event so this design fails.

What's a good alternative to this that doesn't rely on Javascript?

1. Simply not show menus and just have links that go to pages that have the options that would have appeared in the menu dropdown?

2. Use the :active pseudo-class and work out how to make the link reference a bookmark on the page instead of an off-page link?

3. Use a SELECT control with OPTIONs for each item in the menu. Some mobile devices have excellent support for these.

4. Liquid Nitrogen?

推荐答案

OnFingerHover ? :)



我想我会选择选项3,除非你说某些设备,好像要说*某些*设备DON 它有支持(或非常好的支持)。



BTW,由于日本的海啸,液氮供不应求。
OnFingerHover? :)

I think I'd go with option 3, except you made it a point to say "some" devices, as if to say *some* device DON'T have suppport (or excellent support) for it.

BTW, Liquid Nitrogen is in short supply because of the Tsunami in Japan.

这篇关于什么是javascript onmousover / CSS的替代品:悬停在没有鼠标的移动设备上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆