@6h/click-outside

点击指定元素之外触发

Usage no npm install needed!

<script type="module">
  import 6hClickOutside from 'https://cdn.skypack.dev/@6h/click-outside';
</script>

README

@6h/click-outside

NPM Version

点击指点元素外部触发回调, 支持手机/桌面端.

返回首页

安装

npm i -S @6h/click-outside

使用

import clickOutside from '@6h/click-outside';

// 开始监听
const cancel = clickOutside(el, e=>{
    // 点击el外部触发
});

// 取消监听
cancel();

返回首页