项目
在 GitHub 查看
jj811208/watching-you
关于
watching-you 是一个 JavaScript 库,用于构建能够观察 DOM 中任意内容的动画 👀。
网站与应用开发可以做什么
- Be able to watch the mouse or another DOM, or even input values, watch anything you want!
- Because it is DOM-based, it is easy to support RWD
- Supports multiple frameworks
- Zero dependency (every framework is!)
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- -2
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文
Features
- Be able to watch the mouse or another DOM, or even input values, watch anything you want!
- Because it is DOM-based, it is easy to support RWD
- Supports multiple frameworks
- Zero dependency (every framework is!)
- Written in typescript
- The size of the core code is only 3kb after gzip compression
- If the element is not on the screen, it will automatically stop watching
Example
The source code can be found here
Storybook
watching-you's storybook using react, but every framework can do the same thing!
https://jj811208.github.io/watching-you/storybook
Documents
⚠️ The API is still subject to change until version 1.0.0 is released ⚠️
Compatibility
If you use watching-you directly without any compiler(babel), (e.g. Wordpress project using CDN import watching-you)
| Chrome | Firefox | Safari | Edge | Opera | iOS Safari/Chrome | Android Chrome | |
|---|---|---|---|---|---|---|---|
| Supported | 70+ | 73+ | 14.1+ | 80+ | 70+ | 14.1+ | ✔ |
But if you use a compiler like babel and import polyfill, it can even support IE11
Some references:
https://babeljs.io/
https://github.com/vitejs/vite/tree/main/packages/plugin-legacy
Note
- When watching
inputortextarea, thetext-alignattribute must beleft - Some inline elements ignore the
transformattribute (let's sayspan), so you have to give them thedisplayattribute to work properly. (see: https://stackoverflow.com/questions/24961795/how-can-i-use-css3-transform-on-a-span) - You may need something like
transition: transform .1sdepending on your needs
Contributing
License
探索相关项目
加载中…