We are again back with another interesting miniature javascript called the “df Smooth Scroll“. This script is also one of the smallest Smooth Scrolling Javascripts after our Simple Accordions.
We always see that we have atleast one image on every post of ours… but for this script we were too confused to go about the image and finally put up the above one (sorry if it pains your eyes cos its motion blurred )
Usage: This script is too simple to understand and use. Nothing but playing with Anchor Tags. Include the Javascript and you are set to smoooooooooth scroll…
| Attachment | Size | Hits | Last download |
|---|---|---|---|
| dfSmooth Scroll | 5.66 KB | 45453 | 1 hour 59 min ago |
Comments
Absolutely awesome! Much simpler than mooscroll love it love it love it thank you!
Hello. Great bit o' Javascript. Have applied it to my simple website (www.themoreiblog) and I was wondering if someone could help me. If you click "archive" on my website, you are smooth scrolled down to the right anchor, but it positions it at the foot of the browser, rather than at the top. Please -- any ideas would be much appreciated. Cheers all.
How can i use it to scroll down a hidden overflow div?
Great script.. but didn't work for the latest version of opera.. can someone solve the problem?
Source code:
http://choen-bookmarks.blogspot.com/2009/03/tutorial-smooth-scrolling.ht...
For those who need the decrypted code: ;-)
Scroller={speed:10,offsetParent:function(d){offsetParent=d.offsetTop;if(d.offsetParent){while(d=d.offsetParent){offsetParent+=d.offsetTop}}return offsetParent},scrollTop:function(){body=document.body;d=document.documentElement;if(body&&body.scrollTop){return body.scrollTop}if(d&&d.scrollTop){return d.scrollTop}if(window.pageYOffset){return window.pageYOffset}return 0},attachEvent:function(a,b,d){if(a.addEventListener){return a.addEventListener(b,d,false)}if(a.attachEvent){return a.attachEvent("on"+b,d)}},end:function(e){if(window.event){window.event.cancelBubble=true;window.event.returnValue=false;return}if(e.preventDefault&&e.stopPropagation){e.preventDefault();e.stopPropagation()}},scroll:function(d){i=window.innerHeight||document.documentElement.clientHeight;h=document.body.scrollHeight;a=Scroller.scrollTop();if(d>a){if(h-d>i){a+=Math.ceil((d-a)/Scroller.speed)}else{a+=Math.ceil((d-a-(h-d))/Scroller.speed)}}else{a=a+(d-a)/Scroller.speed}window.scrollTo(0,a);if(a==d||Scroller.offsetTop==a){clearInterval(Scroller.interval)}Scroller.offsetTop=a},init:function(){Scroller.attachEvent(window,"load",Scroller.load)},load:function(){a=document.getElementsByTagName("a");Scroller.end(this);window.onscroll;for(i=0;i
Great little script. One thing - I want the page to open at lets say the middle anchor rather then the top. How do I do this ?
nice post!
Thanks,
congtythietkewebsite.com
Can you smooth scroll two things at once? Like two iframes from the main page or the main page and an iframe? This is a feature that I haven't gotten to work with other frameworks.
hi,
i was wondering, if smooth scroll works from FLASH (AS2).
I have a line getURL('#footer') - this does not work. Any ideas how could smooth scroll work from flash.
thanks.
Post new comment