navigate event
添加的版本:1.3
說明:popstate 的包裝事件
導航事件是popstate
事件的包裝。除了為所有瀏覽器提供單個事件之外,它還在兩種情況下都提供了一個數據對象,以允許統一處理程序。 $.mobile.navigate
方法使用此函數來包含方向性和 URL 信息。
例子:
更改哈希片段兩次,然後在瀏覽器向後移動曆史記錄時記錄導航事件提供的數據。注意:默認情況下,僅支持 hashchange 的瀏覽器不會提供狀態。有關該函數,請參閱導航方法文檔。
// Bind to the navigate event
$( window ).on( "navigate", function( event, data ) {
console.log( data.state );
});
// Trigger a navigate event by pushing state
window.history.pushState( { foo: "bar" }, "Title", "http://example.com/#foo" );
// From the `navigate` binding on the window, console output:
// => {}
// Trigger a navigate event by pushing state
window.history.pushState( {}, "Title", "http://example.com/#bar" );
// From the `navigate` binding on the window, console output:
// => {}
// Trigger a navigate event by moving backward through history
window.history.back();
// From the `navigate` binding on the window, console output:
// => { foo: "bar" }
相關用法
- JQuery nextAll()用法及代碼示例
- JQuery not()用法及代碼示例
- JQuery next()用法及代碼示例
- JQuery noop()用法及代碼示例
- JQuery nextUntil()用法及代碼示例
- JQuery now()用法及代碼示例
- JQuery Mobile Popup initSelector用法及代碼示例
- JQuery Mobile Collapsibleset disabled用法及代碼示例
- JQuery UI Datepicker prevText用法及代碼示例
- JQuery ajaxError()用法及代碼示例
- JQuery Mobile Selectmenu defaults用法及代碼示例
- JQuery UI Tabs event用法及代碼示例
- JQuery UI Selectable appendTo用法及代碼示例
- JQuery UI :focusable Selector用法及代碼示例
- JQuery UI Selectmenu disabled用法及代碼示例
- JQuery UI Button classes用法及代碼示例
- JQuery .jquery用法及代碼示例
- JQuery .scroll()用法及代碼示例
- JQuery UI Draggable snapMode用法及代碼示例
- JQuery each()用法及代碼示例
- JQuery Mobile Toolbar hide用法及代碼示例
- JQuery UI Tabs option用法及代碼示例
- JQuery UI Buttonset widget用法及代碼示例
- JQuery .add()用法及代碼示例
注:本文由純淨天空篩選整理自jquerymobile.com大神的英文原創作品 navigate。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。