Home > Web Front-end > JS Tutorial > History history plug-in based on jQuery_jquery

History history plug-in based on jQuery_jquery

WBOY
Release: 2016-05-16 18:14:08
Original
1771 people have browsed it

About jQuery History
jQuery history plugin helps you to support back/forward buttons and bookmarks in your javascript applications. You can store the application state into URL hash and restore the state from it. You can store the application state into URL hash and restore the state from it.

Download jquery.history.js
Download jquery.history.js

jQuery history plugin is hosted on Github.
The history jQuery plugin is hosted on Github.
Please visit the project page for development.
Please visit the project page for development.

Supported browsersSupported browsers
Internet Explorer 6, 7, and 8
Safari 4 and 5
Safari 4 and 5
Google Chrome 4
Google Chrome 4
This plugin is built on hashchange event , which is defined in HTML5 and supported in most modern browsers. Unless it is supported the plugin works on some fallback mechanisms: Events are defined in browsers that support HTML5 and are the most modern mechanism. Unless some back-up plug-in projects are supported:

monitoring location.hash by setInterval (Safari 4)
Monitoring setInterval location.hash (Safari 4)
iframe and setInterval (IE 6, 7, and compatibility mode on IE8)
iframe and setInterval (i.e. 6, 7, and compatibility mode of IE8)
Known issues
Known issues
IE6, 7, and IE8 compatibility mode
In compatibility mode of IE6, 7 and IE8
Back/forward button will not work if you refresh the page and the document is reloaded.
Back/forward button will not work if you refresh the page and the document is reloaded. load.
IE8 standards mode
IE8 standards mode
The current hash will not be recorded in the history if you update the URL hash by hand or loading bookmarks. Historically, if you update the bookmark URL by hand or load the hash.

Demos
Some demos are available here and included in the repository.
And this site itself is built on the plugin:

Copy Code The code is as follows:
(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);


Package download
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template