Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var $content = null;
- var $loader = null;
- function ajaxNavigation(ev) {
- ev.preventDefault();
- // Do fancy loading.
- $content.fadeOut();
- $loader.fadeIn();
- // Get the page content via AJAX.
- $.get($(this).attr('href'), function (data) {
- var $newContent = $(data).find('#content');
- // Rebind the navigation.
- $newContent.find('#previous,#next').click(ajaxNavigation);
- // Insert the content from the loaded page into the current page.
- $content.html($newContent).fadeIn();
- });
- }
- $(document).ready(function () {
- $content = $('#content');
- $loader = $('#loader');
- // Override previous and next button functionality.
- $('#previous,#next').click(ajaxNavigation);
- });
Advertisement