by
25
8
2,803
2
Top 1% !
Popular
Famous
Nice
Useful
Easy-to-find
Specified
Pattern
Popularity: 5450th place
Languagejavascript
LicenseMIT_X11

......  SkRoLLa.js sOOooOOOoo SmOooOOOootH...

JuSt Give A liNk the ID:  'arrow", call Skrolla.start() some where after the document.ready
and there ya have, animated-one-click, scroll to the top control for your page. oh YeaH!
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/223888/--------SkRoLLa-js-sOOooOOOoo-SmOooOOOoo?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
// Skrolla! NoW yeR a RoLLA! var Skrolla = (function (wdw, $) { function scrolld () { if ($(this).scrollTop() > 100) { $('#arrow').fadeIn(); } else { $('#arrow').fadeOut(); } } function doScroll () { $("body,html").animate({ scrollTop: 0 }, 1200); return false; } var startMe = function () { $(wdw).scroll(scrolld()); $("#arrow a").click(doScroll()); }; return { start: startMe }; }(window, jquery));
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus