1.0.4 • Published 6 years ago

jquery-scrollsync v1.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

jquery-ScrollSync

A jQuery plug-in that synchronizes the scrolling of several containers with scrollbars, such as iframe.(It works like bidirectional bindings, which let containers' scrollTop and scrollLeft synchronous, and using conditional bidirectional bindings which can avoid cycle synchronizes.)

Installation

npm安装:

npm install jquery-scrollsync

Usage

默认同步滚动:

$('selector').scrollsync()

取消同步滚动:

$('selector').closeScrollsync()

不同步横向滚动条:

$('selector').scrollsync({x_sync: false})

不同步纵向滚动条:

$('selector').scrollsync({y_sync: false})

使用smartscroll(使滚动事件执行频率降低,默认10ms内只触发一次):

$('selector').scrollsync({use_smartscroll: true})

使用smartscroll且自定义触发间隔时间为30ms:

$('selector').scrollsync({smartscroll_delay: true, smartscroll_delay: 30})

Options

OptionDefault valueTypeDescription
x_synctrueBoolean是否绑定横向滚动条
y_synctrueBoolean是否绑定纵向滚动条
use_smartscrollfalseBoolean是否使滚动事件执行频率降低,默认10ms内只触发一次
smartscroll_delay10Number自定义use_smartscroll的触发间隔