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 | 58704 | 5 min 35 sec ago |
Comments
Very nice scroller. I customised it to use id attribute of the tag instead of name, it then validates to xhtml1.1.
Used on our site http://www.zoneix.net
Awesome. so easy, just paste the code directly above in your html file, and include the two java script files in the associated folder. Works every time, unlike some other versions I'd been trying. Thanks!
(unfortunately, I noticed the scroller does not work when links are withing dynamic menus)
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
Post new comment