view source Event.observe(window, 'load', function() { $$('a[href^=#]:not([href=#])').each(function(element) { element.observe('click', function(event) { new Effect.ScrollTo(this.hash.substr(1)); Event.stop(event); }.bindAsEventListener(element)) }) }) back to the blog post Main Content Index First Section Second Section Third Section First section Lorem ipsum dolor sit amet, consect