Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery mobile tool-tip popup("close") function is not working in IPhone 5

In my JQuery Mobile site I've added a tool-tip dialog box to open when the page is load and It'll disappear after 5sec. My code is similar to follows,

  <div data-role="popup" id="popupInfo">
     <p>This is a completely basic popup, no options set.<p>
  </div>

  <script type="text/javascript">
 $(document).live( 'pagechange',function(event){
     $('#popupInfo').popup("open")
      setTimeout(function() {
      $('#popupInfo').popup("close");
      }, 5000);
  });
   </script>

This update is working fine in all devices except in IPhone 5 iOS 6. Because when I tried to load my JQuery mobile page with above script in IPhone 5 iOS 6 device it redirect me to the previous page when the popup closing. I'm not sure what I've missed here but for me it looks like jQuery Mobile popup("close") function is not supporting for IPhone 5 iOS 6.

Also when the tool-tip load following hash tag text appending to the URL how can we avoid this #&ui-state=dialog

Could anyone please let me know how can we solve this issue ?

I've even tried following code also;

 $(document).on('pagechange',function(event){
        $('#popupInfo').popup("open").delay(2000).popup("close");

    });

But this is not working at all

like image 723
FR STAR Avatar asked Feb 21 '13 18:02

FR STAR


3 Answers

Got it. Add data-history="false" to the popupBasic Popup div.

<!-- Button / works without it -->
<a href="#popupBasic" data-rel="popup">Open Popup</a>

<!-- Popup #popupBasic -->
<div data-role="popup" id="popupBasic" data-history="false">
<p>This is a completely basic popup.<p>
</div>

JS:

<script type="text/javascript">

 $(document).live( 'pagechange',function(){
 $('#popupBasic').popup("open")
  setTimeout(function() {
  $('#popupBasic').popup("close");
  }, 5000);
 });

</script>

JSfiddle: Popup

like image 148
Omar Avatar answered Nov 19 '22 05:11

Omar


Also alternatively..jquery mobile surrounds pop-ups with a div having ID = "yourpopupid-popup" So you can simply hide that div.

for example: < div id="basic" data-role="popup" > I am pop up< / div > , then you can close it by : $('#basic-popup').hide();

like image 1
Umesh K. Avatar answered Nov 19 '22 07:11

Umesh K.


Use two functions hide() or you can use close() function on clicking the button

like image 1
Rohit Avatar answered Nov 19 '22 07:11

Rohit