简体   繁体   中英

Calling a dialog then goes back to page that called the dialog

I'm using jquery-mobile 1.3.0 and phonegap 2.8.0 calling a Dialog page from a button the thing is that a make a call as follow

<div data-role="footer" data-position="fixed" data-theme="a" style="height: 0px; border: 0">
    <a id="btnHail" href="#confirm-address-dialog"  data-theme="e" data-rel="dialog">
                <i class="icon-phone"></i> Pedir Taxi
    </a>
</div>

But when it is call the first time the dialog appears but it goes back to the previous page. The code of the dialog is as follow:

<div data-role="page" id="confirm-address-dialog" data-theme="b">
        <div data-role="header" data-theme="e">
            <h1> Titulo </h1>
        </div>
        <div data-role="content" data-theme="b">
            <p>
                Are sure you want this?
            </p>
            <p>
                <b id="txtDataConfirm"></b>
            </p>
            <button id="btnHailConfirm" data-theme="e">
                <i class="icon-phone"></i> Ok
            </button>
        </div>
        <div data-role="footer" data-position="fixed" data-theme="a">
            <p>footer heading</p>
        </div>

</div>

This happen on an iPhone 4s (as developer) the problem never happen on chrome or mozilla. I have tried to use popups but there are some restriction with using popups that it doesn't show on my footer.

I appreciate for any help.

I tried a lot of solutions but not of them worked. As I said before I didn't have any problem with the chrome or any browser on my desktop but on my iPhone it didn't work. What I found was the error was principally within the browser. So I set the configuration of the pushStateEnabled as false. I did it by doing the following, adding this script.

<script type="text/javascript">
$(document).bind("mobileinit", function(){
$.mobile.pushStateEnabled = false;
});
</script>

It should be add before the jquery-mobile script is call, for more information you could see it on JQuery description

And it solved the problem no more jumping back.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM