CSS3选择器工作像jQuery的.click()? [英] CSS3 Selector That Works like jQuery's .click()?

查看:254
本文介绍了CSS3选择器工作像jQuery的.click()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用纯CSS导航几年了,最近我们开始在我工作的公司建立一堆移动网站。我真的想继续使用纯CSS,并注意依赖jQuery,但在移动网站上,下拉菜单不能正常工作。

I've been using a pure CSS navigation for a few years now, and lately we've started building a bunch of mobile sites at the company I work for. I'd really like to keep using pure CSS, and note rely on jQuery, but on a mobile site, drop down menu's don't work correctly.

在CSS3中有类似于jQuery的 .click(); 事件的东西吗?基本上,当用户点击导航链接时,我想让下拉菜单打开并保持打开。

Is there something similar to jQuery's .click(); event in CSS3? Basically, when a user clicks on a navigation link, I want the drop down to open and stay open. I've tried looking around, but I can't seem to find anything.

推荐答案

您可以使用:target 选择器。请参见 Chris Coyier的有关信息。请注意,浏览器支持

You could use the :target selector for some basic functionality. See Chris Coyier's post about it. Note, brower support.

编辑:快速演示

这篇关于CSS3选择器工作像jQuery的.click()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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