博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用Fokus的模态样式文本选择
阅读量:2514 次
发布时间:2019-05-11

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

Every once in a while I find a tiny JavaScript library that does something very specific, very well.  My latest find, , is a utility that listens for text selection within the page, and when such an event occurs, shows a beautiful modal dialog in the background of the entire page, allowing only the highlighted block to display at it's normal mode.

偶尔我会发现一个很小JavaScript库,它做的非常好,非常好。 我的最新发现是一种实用程序,可侦听页面中的文本选择,并且当发生此类事件时,它会在整个页面的背景中显示漂亮的模式对话框,仅允许突出显示的块以其正常模式显示。

HTML (The HTML)

Nothing special needs to be done with the page HTML, and you don't create "active" zones -- simply include the JavaScript file at the bottom of the page:

页面HTML不需要做任何特别的事情,并且您无需创建“活动”区域-只需在页面底部添加JavaScript文件即可:

The overlay elegantly fades in and out.  Canvas is used to create the overlay, and CSS' pointer-events property is used to ensure event handling consistency.  It would be great if Fokus was a bit more modular, including allowing active zones and customized overlay color, but it's hard to complain about anything else with Fokus.

覆盖层淡入淡出。 Canvas用于创建叠加层,而CSS的pointer-events属性用于确保事件处理的一致性。 如果Fokus更具模块化,包括允许活动区域和自定义的覆盖颜色,那就太好了,但是Fokus很难抱怨其他任何事情。

Fokus isn't a necessity for any site, but I was taken aback by how smooth and accurate Fokus is.  Weighing in at just 3KB, it's an impressive little library.  Have an idea for how you'd use Fokus?  Share it!

Fokus并不是任何站点的必需品,但是Fokus如此平滑和准确使我感到惊讶。 它只有3KB的重量,是一个令人印象深刻的小图书馆。 有一个关于如何使用Fokus的想法吗? 分享它!

翻译自:

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

你可能感兴趣的文章
MySQL的数据类型
查看>>
获取控件在运行时于屏幕中的位置
查看>>
删除多个重复记录
查看>>
Meteor Shower POJ - 3669
查看>>
urllib
查看>>
.Net内存程序集的DUMP(ProFile篇)
查看>>
《Linux命令行与shell脚本编程大全 第3版》高级Shell脚本编程---40
查看>>
NIOS II 中用结构体指示灯终于正常了
查看>>
CF1009F Dominant Indices - 题解
查看>>
memached实现tomcat的session共享
查看>>
django导出excel
查看>>
阿里云服务器CentOS6.9安装maven
查看>>
【搜索】数的划分
查看>>
智能提示
查看>>
[JavaScript] 弹出编辑框
查看>>
一个消息队列MQ调试工具
查看>>
springmvc 访问时找不到配置文件
查看>>
采访吴岳师兄有感 by 王宇飞
查看>>
LVS简略介绍
查看>>
hdu 1021 Fibonacci Again
查看>>