jQuery Mobile dialog opens incorrectly in Safari

279 Views Asked by At

I have problem with jQuery Mobile dialog. When is the page first time loaded (after JQM init) and after that when I click on dialog button (open dialog), dialog is opened incorrectly. Instead of include into DOM, is dialog page opened as a new page. Thats happend only in Safari browser. Have anyone same problem, or any idea how to fix it? Thank you.

index.html

...
    <div>
        <a href="dialog.html" data-rel="dialog" data-role="button">open dialog</a>
    </div>
...

dialog.html

    <!DOCTYPE html> 
    <html>
    <head>
        <meta charset="UTF-8">
        <title>Přidat rezervaci</title>
    <body> 
      <div data-role="page" id="reservation-form" data-close-btn="right" data-history="false">
         <!-- some next code -->
      </div>
    </body>
    </html>

jQuery Mobile configuration:

$.event.special.swipe.horizontalDistanceThreshold = 70;
$.event.special.swipe.scrollSupressionThreshold  = 40;
$.mobile.defaultPageTransition = 'none';
$.mobile.defaultDialogTransition = 'none';
$.mobile.useFastClick = true;

jQuery version: 1.9.1 jQuery mobile version: 1.3.1

Here is the preview:

enter image description here

1

There are 1 best solutions below

0
On

I solved this problem. It was cause by <audio> element hack for mobile devices.

$(document).one("click", "body", function(){
 play(true);
 return false;
});

function play(first){
var a =  $("#audio");
if(a.length !== 0){
    a = a[0];
    if(first){
        a.currentTime=a.duration-.01;
        a.play();
        a.load();
    }else{
        a.play();
    }
}
return false;
}