Feature: Animating scrollTop on scrollable elements
See original GitHub issueThanks for your work on this library - looks promising! I’ve been testing it out and ran into a small issue. We have scrollable elements in our app (overflow-y:scroll) and have used jQuery’s animate like so:
$('.pickup-locations').stop().animate({
scrollTop: this.topPosition - 15
}, 1000);
When I tried dropping in .velocity using the new syntax, it didn’t seem to work:
$('.pickup-locations')
.velocity('stop')
.velocity({ scrollTop: this.topPosition - 15 },{ duration: 1000 });
I also tried this, but it only seems to scroll the window to the element’s position, not the element itself:
$('.pickup-locations')
.velocity('stop')
.velocity('scroll', { duration: 1000, offset: this.topPosition });
Any thoughts on how to achieve animated scrolling inside a scrollable element? Thanks!
Issue Analytics
- State:
- Created 9 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Scroll to an element with jQuery - javascript - Stack Overflow
When the user clicks on the <input id="#subject"> , the page should scroll to the page's last element, and it should do so...
Read more >How to animate scrollTop using jQuery ? - GeeksforGeeks
This method is used with the scrollTop property to animate the scrolling on the page. The jQuery selector is used to select both...
Read more >Element.scrollTop - Web APIs | MDN
The Element.scrollTop property gets or sets the number of pixels that an element's content is scrolled vertically.
Read more >13959 (scrollTop animation on root scrollable element) – jQuery
Second of all, html and body do not both need to be scrollable. Only one of the animations needs to work (http://codepen.io/timmywil/pen/LIqar). Last,...
Read more >How to Animate on Scroll With Vanilla JavaScript - Web Design
In this tutorial you'll learn how to implement animation on scroll using vanilla JavaScript and CSS.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a quick follow-up question - is this the correct way to scroll the full browser window using velocity?
Beautiful. This is why I spend time on Velocity. Because I love it when people show me what they make with it 😃
When it’s converted to Velocity, tweet to me and I can link to relay and your own portfolio in the upcoming Velocity gallery.
Sent from my phone.