Skip to content

Commit d63350c

Browse files
author
scottjehl
committed
set initial page div's data-url to location.pathname unless it has an ID on it. This fixes an issue where going back to the initial page will end up generating a new homepage rather than transitioning to the one already in the dom.
1 parent 6de7616 commit d63350c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

docs/_assets/css/jqm-docs.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cobblers, shoes,
66

77
body { background: #dddddd; }
88

9-
.ui-mobile #jqm-home { background: #e5e5e5 url(../images/jqm-sitebg.png) top center repeat-x; }
9+
.ui-mobile .type-home { background: #e5e5e5 url(../images/jqm-sitebg.png) top center repeat-x; }
1010
.ui-mobile #jqm-homeheader { padding: 40px 10px 0; text-align: center; margin: 0 auto; }
1111
.ui-mobile #jqm-homeheader h1 { margin: 0 0 ; }
1212
.ui-mobile #jqm-homeheader p { margin: .3em 0 0; line-height: 1.3; font-size: .9em; font-weight: bold; color: #666; }

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
</head>
1515
<body>
16-
<div data-role="page" id="jqm-home" class="type-home">
16+
<div data-role="page" class="type-home">
1717
<div data-role="content">
1818

1919

js/jquery.mobile.init.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@
8383
$pages.add( ":jqmData(role='dialog')" ).each(function() {
8484
var $this = $(this);
8585

86-
// unless the data url is already set set it to the id
86+
// unless the data url is already set set it to the pathname
8787
if ( !$this.jqmData("url") ) {
88-
$this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) );
88+
$this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) || location.pathname );
8989
}
9090
});
9191

0 commit comments

Comments
 (0)