navigate 이벤트 정보
jQuery Mobile navigate 이벤트본문
navigate 이벤트 버전이 추가 : 1.3
설명 : 해시 체인지와 팝 스테이트에 대한 래퍼 이벤트
navigate 이벤트는 hashchange및 popstate이벤트 둘 다에 대한 래퍼 입니다. 모든 브라우저에 대해 단일 이벤트를 제공하는 것 외에도, 두 경우 모두 핸들러의 통합을 허용하는 데이터 오브젝트를 제공합니다. 이 기능은 $.mobile.navigate방법에 의해 방향성 및 URL 정보를 포함 하는 데 사용됩니다 .
예:
브라우저가 히스토리를 통해 뒤로 이동하면 해시 조각을 두 번 변경 한 다음 navigate 이벤트와 함께 제공된 데이터를 기록하십시오. 참고 : 상태는 기본적으로 해시 변경 만 지원하는 브라우저에서는 제공되지 않습니다. 해당 기능을 보려면 navigate 메소드 문서를 참조하십시오.
// 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" }
설명 : 해시 체인지와 팝 스테이트에 대한 래퍼 이벤트
navigate 이벤트는 hashchange및 popstate이벤트 둘 다에 대한 래퍼 입니다. 모든 브라우저에 대해 단일 이벤트를 제공하는 것 외에도, 두 경우 모두 핸들러의 통합을 허용하는 데이터 오브젝트를 제공합니다. 이 기능은 $.mobile.navigate방법에 의해 방향성 및 URL 정보를 포함 하는 데 사용됩니다 .
예:
브라우저가 히스토리를 통해 뒤로 이동하면 해시 조각을 두 번 변경 한 다음 navigate 이벤트와 함께 제공된 데이터를 기록하십시오. 참고 : 상태는 기본적으로 해시 변경 만 지원하는 브라우저에서는 제공되지 않습니다. 해당 기능을 보려면 navigate 메소드 문서를 참조하십시오.
// 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" }
추천
0
0
댓글 0개