Releases: scroll-into-view/scroll-into-view-if-needed
Releases · scroll-into-view/scroll-into-view-if-needed
v2.1.1
v2.1.0
v1.5.1
1.5.1 (2018-04-28)
Bug Fixes
- improve examples and add tests (#191) (11105b1)
- move animation code to smooth package (#187) (c15f4ea)
- ci: remove faulty plugin (#179) (8e4e220)
- pin dependencies (#169) (011d25a)
- semantic release setup (#202) (2ee61bd)
- update dependency bulma to v0.7.1 (#170) (c11325a)
- update dependency codemirror to v5.37.0 (#171) (56c2cd7)
- update dependency react-codemirror2 to v4.3.0 (#175) (a07cd58)
- update dependency react-codemirror2 to v5 (#176) (22a6eb5)
- update react monorepo to v16.3.2 (#172) (429224c)
- ci: semantic-release config errors (#178) (082cc12)
- ci: test semantic-release (83f07b9)
- deps: update dependency @types/node to v9.6.7 (#196) (3e68eae)
- deps: update dependency @types/react to v16.3.13 (#198) (91227f9)
- deps: update dependency @zeit/next-css to v0.1.5 (#194) (e7b62ca)
- deps: update dependency react-codemirror2 to v5.0.1 (#192) (62173f2)
smooth-scroll-into-view-if-needed-v1.0.1
smooth-scroll-into-view-if-needed-v1.0.0
v1.5.0
v1.4.1
v1.4.0
Added
- New
handleScroll
option allows customizing scrolling behavior.
Changed
- Animation logic is separated from scroll calculation logic. This allows skip
importing animation dependencies and reduces bundle sizes when you don't need
the built in animation feature.
What this means
Take control over how the target is scrolled into view. This function is called
for each parent node that need scrolling. scrollLeft
and scrollTop
are
destination coordinates. The from coordinates you'll have to get yourself if you
want to animate the transition using a different library.
When using this option you likely don't need the built in animation feature. To
cut down on filesize you can do the following adjustment if you are using a
recent version of webpack or rollbar (and use ES6 imports):
-import scrollIntoViewIfNeeded from 'scroll-into-view-if-needed'
+import maybeScrollIntoView from 'scroll-into-view-if-needed/dist/calculate'
-scrollIntoViewIfNeeded(node)
+maybeScrollIntoView(node, {handleScroll: (parent, {scrollLeft, scrollTop}, config) => {
+ // The following is actually the default implementation
+ // if this is all you need you can skip passing this option
+ parent.scrollLeft = scrollLeft
+ parent.scrollTop = scrollTop
+}})