Ajax Navigation

An ajax navigation plugin. Allows:

Basic setup:

        <link rel="stylesheet" href="style.css">

            <!-- Page Contents -->

        <script src="jquery.js"></script>
        <script src="ajax.js"></script>

        <script data-plugin src="plugins.js"></script>
        <script data-page src="main.js"></script>
            $(function() {
                var ajax = new Ajax({root: "http://sprawledoctopus.com/"});

Page contents is put inside a <main> block, rather than stright inside the <body>. The demo page gives an example CSS for the main block, and page transitions. This stops a problem that occurs when clicking on back or forward buttons that jumps the page to the previous scroll position.

When loaded by ajax, only scripts with data-plugin and data-page attributes are run. Plugins are only run once, page scripts are run each time the page is displayed. Stylesheets will also be loaded only once.