Reputation: 28875
I am beginning to truly hate JQuery Mobile but have to stick it out. Any help with this problem is much appreciated!
Ok, I have a startup page that just checks a few things and, if all is well, it sends the user to another page. I do NOT want the new page to be loaded via AJAX so I do this:
window.location.href = "main.html";
On the main.html page I have a Popup on the first "Page" in the file:
<div data-role="page" data-theme="b" id="MenuPage">
<div data-role="content" style="padding: 10px; padding-top:0px;" id="MenuBody">
...stuff and things...
</div>
<div data-role="popup" id="TapPanel" data-theme="b" data-add-back-btn="false">
<h3>Navigation</h3>
<p>To return to this menu from any other screen, tap the logo shown above.</p>
</div>
</div>
In Javascript I set the popup to appear when the page first loads using:
$(function () {
setTimeout($("#TapPanel").popup("open", { x: 10, y: 140 }), 1500);
});
The problem is that when I click/tap anywhere off of this popup message (which will only show up the first time eventually) it tries to go "back" to the page that called this one, which just reopens this one - redisplaying the popup. In other words, I cannot get rid of the popup once it is shown. This is just perverse! Worse yet, the popup closed just fine before and I have no clue what made it start acting this way.
As you can see, I have tried "data-add-back-btn='false'" but that isn't helping.
Also I am using jquery-1.10.2 and jquery.mobile-1.3.2. Any help would be much appreciated.
Upvotes: 0
Views: 139
Reputation: 31732
To prevent popup to alter URL once closed/hidden, add data-history="false"
attribute to popup div. or set it programmatically $('#popup').popup({ history: false });
.
Reference: popup widget API
Upvotes: 3