Skip to content

Commit b344ef9

Browse files
Merge branch 'master' of https://github.com/jquery/jquery-mobile
2 parents 4c41f63 + 0f9e8f4 commit b344ef9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/demos/_assets/js/h2widget.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,18 @@
2525
} else if( typeof f.toPage !== "object" && hash !== "" && $.mobile.path.parseUrl( f.originalHref ).hash !== "" && !$( hash ).hasClass( "ui-page" ) && $(hash).attr('data-role') !== "page" && !$( ".ui-page-active " + hash ).hasClass( "ui-panel" ) && !$( ".ui-page-active " + hash ).hasClass( "ui-popup" )){
2626
$( ele ).attr( href, f.originalHref );
2727
$.mobile.document.one( "pagechange", function(){
28-
hash = $.mobile.path.parseUrl(f.originalHref).hash;
29-
var pos = $( ".ui-page-active " + hash) .offset().top;
30-
$.mobile.silentScroll( pos );
28+
if( typeof hash !== "undefined" && hash.search( "/" ) === -1 && hash !== "" && $( hash ).length > 0 && !$( hash ).hasClass( "ui-page" ) && $(hash).data('role') !== "page" && !$( ".ui-page-active " + hash ).hasClass( "ui-panel" ) && !$( ".ui-page-active " + hash ).hasClass( "ui-popup" )){
29+
hash = $.mobile.path.parseUrl(f.originalHref).hash;
30+
var pos = $( ".ui-page-active " + hash) .offset().top;
31+
$.mobile.silentScroll( pos );
32+
}
3133
} );
3234
}
3335
});
3436
$( document ).on( "mobileinit", function(){
3537
hash = window.location.hash;
3638
$.mobile.document.one( "pageshow", function(){
37-
if( hash !== "" && !$( ".ui-page-active " + hash ).hasClass( "ui-page" ) && !$( ".ui-page-active " + hash ).hasClass( "ui-panel" ) && !$( ".ui-page-active " + hash ).hasClass( "ui-popup" ) && !$( hash ).is( "body" ) ){
39+
if( hash !== "" && $(hash).attr('data-role') !== "page" && !$( hash ).hasClass( "ui-page" ) && !$( ".ui-page-active " + hash ).hasClass( "ui-panel" ) && !$( ".ui-page-active " + hash ).hasClass( "ui-popup" ) && !$( hash ).is( "body" ) ){
3840
var pos = $( ".ui-page-active " + hash ).offset().top;
3941
setTimeout( function(){
4042
$.mobile.silentScroll( pos );

0 commit comments

Comments
 (0)