New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

scroll-syncer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-syncer - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

32

index.common.js

@@ -15,5 +15,5 @@ // detect if user-agent support passive event binding

function ScrollSyncer (vertical, horizontal) {
this._vertical = vertical
this._horizontal = horizontal
this._from = null
this._vertical = vertical
this._horizontal = horizontal
this._from = null
this._to = []

@@ -25,21 +25,21 @@

ScrollSyncer.prototype.from = function (target) {
if (!target || !target.addEventListener) return
this._from = target
this._from.addEventListener('scroll', this._scrollHandler, bindOptions)
this.sync()
if (!target || !target.addEventListener) return
this._from = target
this._from.addEventListener('scroll', this._scrollHandler, bindOptions)
this.sync()
}
ScrollSyncer.prototype.to = function (target) {
if (!target) return
this._to.push(target)
this.sync()
if (!target) return
this._to.push(target)
this.sync()
}
ScrollSyncer.prototype.sync = function () {
if (this._from) {
this._to.forEach(function (el) {
if (this._vertical) el.scrollTop = this._from.scrollTop
if (this._horizontal) el.scrollLeft = this._from.scrollLeft
}, this)
}
if (this._from) {
this._to.forEach(function (el) {
if (this._vertical) el.scrollTop = this._from.scrollTop
if (this._horizontal) el.scrollLeft = this._from.scrollLeft
}, this)
}
}

@@ -46,0 +46,0 @@

{
"name": "scroll-syncer",
"version": "1.0.0",
"version": "1.0.1",
"description": "Synchronize scoll position among several elements",

@@ -5,0 +5,0 @@ "main": "index.common.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc