Skip to content
/ watcher Public

watch dom is in viewport and scroll to element

License

Notifications You must be signed in to change notification settings

biorz/watcher

Repository files navigation

watcher


监听元素进出视口,跳转至指定元素位置 demo


  • 无依赖
  • 简明的api
  • 支持多层级
  • 支持多方向
  • 性能优化
  • 持续更新

示例

<script src="../dist/watcher.min.js"></script>
<script>
    let ins = watcher('.watch')
        .on('enter', el => {
            console.log(el)
        })
        .on('exit', el => {
            console.log(el)
        })
        .scroll(document.querySelector('#id'), 300)         
</script>

About

watch dom is in viewport and scroll to element

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published