jQuery history plugin

Demos

Some demos are available here and included in the repository.

And this site itself is built on the plugin:

(function($){ 
    var origContent = ""; 
 
    function loadContent(hash) { 
        if(hash != "") { 
            if(origContent == "") { 
                origContent = $('#content').html(); 
            } 
            $('#content').load(hash +".html", 
                               function(){ prettyPrint(); }); 
        } else if(origContent != "") { 
            $('#content').html(origContent); 
        } 
    } 
 
    $(document).ready(function() { 
            $.history.init(loadContent); 
            $('#navigation a').click(function(e) { 
                    var url = $(this).attr('href'); 
                    url = url.replace(/^.*#/, ''); 
                    $.history.load(url); 
                    return false; 
                }); 
        }); 
})(jQuery);
http://tkyk.github.com/jquery-history-plugin/#demos
原文地址:https://www.cnblogs.com/stalwart/p/1917421.html