基於jQuery的history記錄外掛程式_jquery

來源:互聯網
上載者:User
關於jQuery的曆史
jQuery history plugin helps you to support back/forward buttons and bookmarks in your javascript applications.曆史的jQuery外掛程式可以協助您回到您的JavaScript支援應用程式/前進按鈕和書籤。 You can store the application state into URL hash and restore the state from it.你可以儲存到應用程式狀態的網址散列和恢複它的狀態。

Download jquery.history.js
下載jquery.history.js

jQuery history plugin is hosted on Github.
曆史的jQuery外掛程式託管在Github上。
Please visit the project page for development.
請訪問項目頁面進行開發。

Supported browsers支援的瀏覽器
Internet Explorer 6, 7, and 8+的Internet Explorer 6,7和8 +
Safari 4 and 5+的
Safari 4和5 +
Google Chrome 4+
Google瀏覽器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:這個外掛程式是在建hashchange事件 ,這是定義在瀏覽器支援HTML5和最現代化的機制。除非是支援一些後備外掛程式工程:

monitoring location.hash by setInterval (Safari 4)
監測的setInterval location.hash(Safari 4中)
iframe and setInterval (IE 6, 7, and compatibility mode on IE8)
iframe的和setInterval(即6,IE8的第7和相容模式)
Known issues
已知問題
IE6, 7, and IE8 compatibility mode
在IE6,7和IE8的相容模式
Back/forward button will not work if you refresh the page and the document is reloaded.
後退/前進按鈕將不會工作,如果你重新整理頁面,該檔案重新載入。
IE8 standards mode
IE8的標準模式
The current hash will not be recorded in the history if you update the URL hash by hand or loading bookmarks.
目前雜湊將不會被記錄在曆史上,如果你用手或載入更新書籤網址雜湊。

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);

打包下載

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.