Search code examples
jqueryjquery-mobilebackgroundclicktap

JQM background click issue


I've packaged my JQM App using phoneGap (android & ios). It works fine, but shows an issue like a background click/tap event is occurring is some cases. ie If I clicked on a button in popup window the click is propagated to background button. How can I prevent that? Currently i've set an overlay behind the popup and set some delay for the overlay to remove(i dont think it's a good method), but bottom tab bar is showing same issue since overlay cannot be place here.


Solution

  • I found a solution that, bind the event with the clickable elements to a function when popup window is called. Like this :

    function callPopupWindow(){
      $('#list li a').bind('click',function(e){
       e.preventDefault();
         //steps to do
       e.stopImmediatePropagation();
       $('#list li a').unbind('click');//if not unbinded it will trigger one more event with the elements.
      });
    }
    

    It works in every browser (iphone, andriod and of course in firefox and chrome).