Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Michael Trilford
7,232 PointsJQuery .animate question
On w3schools.com, they say the "params" defines the CSS properties to be animated.
$(selector).animate({params},speed,callback);
But I see we can also insert other functions { scrollTop: 0 } into the same area, which isn't CSS.
function $nameHere () { $('body,html').animate({ scrollTop: 0 }, 800); }
Could someone just explain why, and what other functions can be used here also.
Thanks :D
2 Answers

Andrew Chalkley
Treehouse Guest TeacherOn the official documentation it says "In addition to style properties, some non-style properties such as scrollTop
and scrollLeft
, as well as custom properties, can be animated."

Michael Trilford
7,232 PointsFantastic! I will have a play with scrollLeft also.
Thank you.