Making anchors scroll smoothly into view rather than jump instantly

Many websites have had to make a list of internal anchors that cause the page to jump down to a particular section. The "jump" of the page is a bit of magic that many users do not recognize as an on-page link. Use this eye-candy effect to clearly show that the on-page link is scrolling the page.

Getting ready

Do not get up, do not get coffee, do not blink. The next recipe does days' worth of JavaScript work in one line! Get ready to smoothly scroll to an internal page link.

How to do it...

Brace yourself...

<script type="text/javascript" src="mootools-1.3.0.js"></script> <script type="text/javascript" src="mootools-more-1.3.0.js"></script> </head> <body> Scrolling, Internal Navigation: ...

Get MooTools 1.3 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.