Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smooth-scroll-into-view-if-needed

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smooth-scroll-into-view-if-needed - npm Package Compare versions

Comparing version 1.0.1-alpha.3 to 1.0.1-alpha.4

typings/index.d.ts

6

package.json

@@ -11,6 +11,7 @@ {

},
"version": "1.0.1-alpha.3",
"version": "1.0.1-alpha.4",
"main": "index.js",
"files": [
"es",
"typings",
"umd"

@@ -32,3 +33,3 @@ ],

},
"dependencies": {
"peerDependencies": {
"scroll-into-view-if-needed": "^2.0.1-alpha.0"

@@ -63,2 +64,3 @@ },

"rollup-plugin-uglify": "3.0.0",
"scroll-into-view-if-needed": "^2.0.1-alpha.0",
"semantic-release": "15.1.7",

@@ -65,0 +67,0 @@ "semantic-release-monorepo": "6.0.1",

@@ -7,4 +7,4 @@ [![CircleCI Status](https://img.shields.io/circleci/project/github/stipsan/smooth-scroll-into-view-if-needed.svg?style=flat-square)](https://circleci.com/gh/stipsan/smooth-scroll-into-view-if-needed)

This is a [ponyfill](https://ponyfill.com) for smooth scrolling
`scroll-into-view-if-needed`.
This is an addon to [`scroll-into-view-if-needed`](https://www.npmjs.com/package/scroll-into-view-if-needed) that [ponyfills](https://ponyfill.com) smooth scrolling.
.

@@ -16,3 +16,3 @@ ## [Demo](https://scroll-into-view-if-needed.netlify.com/)

```bash
yarn add smooth-scroll-into-view-if-needed
yarn add smooth-scroll-into-view-if-needed scroll-into-view-if-needed
```

@@ -50,3 +50,3 @@

If the default smooth scrolling ponyfill isn't the duration or easing you want,
you can provide your own scrolling logic by giving `behavior` a callback.
you can provide your own scrolling logic by giving `behavior` a callback (this is actually a `scroll-into-view-if-needed` feature, if this is what you're after then you might need this package).

@@ -59,12 +59,12 @@ ```js

// Your scroll actions will always be an array, even if there is nothing to scroll
behavior: scrollActions =>
behavior: actions =>
// list is sorted from innermost (closest parent to your target) to outermost (often the document.body or viewport)
scrollActions.forEach(([el, scrollTop, scrollLeft]) => {
scrollActions.forEach(({ el, top, left }) => {
// implement the scroll anyway you want
el.scrollTop = scrollTop
el.scrollLeft = scrollLeft
el.scrollTop = top
el.scrollLeft = left
// If you need the relative scroll coordinates, for things like window.scrollBy style logic, just do the math
const offsetTop = el.scrollTop - scrollTop
const offsetLeft = el.scrollLeft - scrollLeft
const offsetTop = el.scrollTop - top
const offsetLeft = el.scrollLeft - left
}),

@@ -71,0 +71,0 @@ // all the other options (scrollMode, block, inline) still work, so you don't need to reimplement them (unless you really really want to)

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