mirror of
https://github.com/Doodle3D/doodle3d-connect.git
synced 2024-12-25 18:13:48 +01:00
39 lines
1012 B
JavaScript
39 lines
1012 B
JavaScript
|
(function( $ ) {
|
||
|
// On document ready
|
||
|
$(function() {
|
||
|
|
||
|
// Bind to the navigate event
|
||
|
$( window ).on( "navigate", function() {
|
||
|
console.log( "navigated!" );
|
||
|
});
|
||
|
|
||
|
// Bind to the click of the example link
|
||
|
$( "#event-example" ).click(function( event ) {
|
||
|
event.preventDefault();
|
||
|
location.hash = "foo";
|
||
|
});
|
||
|
|
||
|
// Bind to the click of the example link
|
||
|
$( "#method-example" ).click(function( event ) {
|
||
|
// Append #bar
|
||
|
$.mobile.navigate( "#bar", {
|
||
|
info: "info about the #bar hash"
|
||
|
});
|
||
|
|
||
|
// Replace #bar with #baz
|
||
|
$.mobile.navigate( "#baz" );
|
||
|
|
||
|
// Log the results of the navigate event
|
||
|
$( window ).on( "navigate", function( event, data ){
|
||
|
console.log( data.state.info );
|
||
|
console.log( data.state.direction );
|
||
|
console.log( data.state.url );
|
||
|
console.log( data.state.hash );
|
||
|
});
|
||
|
|
||
|
// Go back to pop the state for #bar and log it
|
||
|
window.history.back();
|
||
|
});
|
||
|
});
|
||
|
})( jQuery );
|