Skip to content

Commit f03e59b

Browse files
author
scottjehl
committed
exposed $.mobile.updateHash to allow plugins to update the hash without triggering hashchange (when closing a dialog from back button for instance)
1 parent 44d78d4 commit f03e59b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

js/jquery.mobile.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@
271271
}
272272
}
273273

274+
//update hash, with or without triggering hashchange event
275+
$.mobile.updateHash = function(url, disableListening){
276+
if(disableListening) { hashListener = false; }
277+
location.hash = url;
278+
}
279+
274280
//wrap page and transfer data-attrs if it has an ID
275281
function wrapNewPage( newPage ){
276282
var copyAttrs = ['data-role', 'data-theme', 'data-fullscreen'], //TODO: more page-level attrs?
@@ -349,8 +355,7 @@
349355
}
350356
reFocus( to );
351357
if( changeHash && url ){
352-
hashListener = false;
353-
location.hash = url;
358+
$.mobile.updateHash(url, true);
354359
}
355360
removeActiveLinkClass();
356361

0 commit comments

Comments
 (0)