博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
css指针悬停_CSS指针事件
阅读量:2520 次
发布时间:2019-05-11

本文共 2169 字,大约阅读时间需要 7 分钟。

css指针悬停

The responsibilities taken on by CSS seems to be increasingly blurring with JavaScript. Consider the , which prevents iOS's link dialog menu when you tap and hold a clickable element. The pointer-events property is even more JavaScript-like, preventing:

CSS所承担的责任似乎在JavaScript中越来越模糊。 考虑 ,当您按住可点击元素时,该可防止iOS的链接对话框菜单。 pointer-events属性更像JavaScript,可以防止:

  • click actions from doing anything

    从任何动作中点击动作
  • the default cursor pointer from displaying

    显示的默认光标指针
  • CSS hover and active state triggering

    CSS悬停和活动状态触发
  • JavaScript click events from firing

    触发JavaScript点击事件

One CSS property is capable of doing just that!

一个CSS属性就能做到这一点!

CSS (The CSS)

The pointer-events property can have many values, but many of them are only applicable to SVG*: auto, none, visiblePainted*, visibleFill*, visibleStroke*, visible*, painted*, fill*, stroke*, all*, and inherit. The none value prevents the click, state, and cursor actions:

pointer-events属性可以有多个值,但其中不少是只适用于SVG *: autononevisiblePainted*visibleFill*visibleStroke*visible*painted*fill*stroke*all*inheritnone值防止单击,状态和光标操作:

.disabled { pointer-events: none; }

A few quick notes about pointer-events:

关于pointer-events一些简短说明:

  • If children of the element have pointer-events explicitly enabled, clicks will be allowed on those child elements.

    如果该元素的子级具有明确启用的pointer-events ,则将允许在这些子元素上单击。

  • If you add a click event listener to an element, then remove the pointer-events style (or change its value to auto, the click event will fire the designated functionality. Basically, the click event respects the pointer-events value.

    如果将click事件侦听器添加到元素,然后删除pointer-events样式(或将其值更改为auto ,则click事件将触发指定的功能。基本上,click事件尊重pointer-events值。

I first noticed pointer-events used on the Firefox Marketplace website for disabled buttons. A bonus in this case is styleability; think about how awful elements with the disabled attribute look! Of course, don't use pointer-events on elements that could trigger critical functionality -- the style can simply be remove via the console!

我首先注意到Firefox Marketplace网站上用于禁用按钮的指针事件。 在这种情况下,奖金是可样式性; 考虑一下具有disabled属性的可怕元素的外观! 当然,不要在可能触发关键功能的元素上使用pointer-events -可以通过控制台简单地删除样式!

翻译自:

css指针悬停

转载地址:http://fuvwd.baihongyu.com/

你可能感兴趣的文章
iOS 消息推送原理
查看>>
随笔1
查看>>
Codeforces 731 C.Socks-并查集+STL(vector+map)
查看>>
洛谷 P3383 【模板】线性筛素数-线性筛素数(欧拉筛素数)O(n)基础题贴个板子备忘...
查看>>
C语言中的正负数及其输出以及小数
查看>>
Android Fragments 详细使用
查看>>
【转】MySQL-Utilities,mysql工具包
查看>>
使用echarts实现了一个折现图,数据是一天24小时
查看>>
杂项:game_navigation
查看>>
建站手册-职业规划:职业资源
查看>>
基于 Generator 和 Iterator 的惰性列表
查看>>
身为前端开发工程师,你需要了解的搜索引擎优化SEO.
查看>>
一篇文章掌握nightwatch自动化测试
查看>>
vue 上传图片到阿里云(前端直传:不推荐)
查看>>
求最大区间,使得特定的两个数的个数相等
查看>>
node读写Excel操作
查看>>
双飞翼布局
查看>>
android利用wireshark抓包
查看>>
Mac和Windows系统下Mysql数据库的导入导出
查看>>
第五周学习进度情况
查看>>