DOM 元素尺寸监听器 size-sensor
- 授权协议: ISC
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://git.hust.cc/size-sensor/
- 软件文档: https://github.com/hustcc/size-sensor
- 官方下载: https://github.com/hustcc/size-sensor
软件介绍
size-sensor
DOM element size sensor which will callback when the element size changed.
DOM 元素尺寸监听器,当元素尺寸变化的时候,将会触发回调函数!
安装
npm i --save size-sensor
import { bind, clear } from 'size-sensor';或者使用 script 引入,将得到一个全局变量 sizeSensor.
使用
bind & unbind
import { bind, clear } from 'size-sensor';
// bind the event on element, will get the `unbind` function
const unbind1 = bind(document.querySelector('.container'), element => {
// do what you want to to.
});
const unbind2 = bind(document.querySelector('.container'), element => {
// do what you want to to.
});
// if you want to cancel bind event.
unbind1();clear
import { bind, clear } from 'size-sensor';
/*
* // bind the resize event.
* const unbind1 = bind(...);
* const unbind2 = bind(...);
* ...
*/
// you can cancel all the event of element.
clear(element);API
只有 2 API:
bind(element, callback)
绑定一个 reisze 监听方法到 DOM 元素上,调用直接返回 unbind 方法。
clear(element)
清楚 DOM 元素上的所有 resize 监听器函数。
Reference
Online demo click here. Rewrite from KyleAMathews/element-resize-event, will be used on hustcc/echarts-for-react.
License
ISC@hustcc.
Coding the Matrix
Philip N. Klein / Newtonian Press / 2013-7-26 / $35.00
An engaging introduction to vectors and matrices and the algorithms that operate on them, intended for the student who knows how to program. Mathematical concepts and computational problems are motiva......一起来看看 《Coding the Matrix》 这本书的介绍吧!
