Time for action – adding the scroll navigation

In this section we will add the code that will enable animated scrolling.

  1. In another new file in your text editor, add the following code (it should go into a empty function which aliases the $ character, the same as in the other examples):
    $("#content").empty(); var win = $(window), links = $("header nav a"), content = $("#content"), positions = {}, screensize = { width: win.width(), height: win.height() }, pages = $("<div></div>", { id: "pages" }).bind("contentLoaded", function() { var multiplier = Math.ceil(links.length / 2); $(this).appendTo(content).parent().addClass("full"); content.width(screensize.width * multiplier + screensize.width); content.height(screensize.height * multiplier); content.parent().find("header, ...

Get jQuery 1.4 Animation Techniques Beginner's Guide 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.