I have a very simple use case on my index page.
<script src="js/jquery-min.js"></script> <script src="js/jquery-mobile.js"></script> <script type="text/javascript" src="cordova-2.2.0.js"></script> <script> $("body").on("swipeleft", function(event) { alert('hello'); }); </script>
For some reason, this event fires 2 times. Now I am sure that I did not associate another event with the body tag, since this is the first page. I tried other simple events like touchstart etc. They all shoot twice. What am I doing wrong?
Update: -
I changed the answer, which I called correct, as follows, and it worked. Events on this page do not shoot twice.
<head> <script type="text/javascript" src="js/jquery-min.js"></script> <script> $(document).bind("mobileinit", function() { $.mobile.autoInitializePage = false; $.mobile.defaultPageTransition = 'none'; $.mobile.touchOverflowEnabled = false; $.mobile.defaultDialogTransition = 'none'; $.mobile.loadingMessage = '' ; }); </script> <script type="text/javascript" src="js/jquery-mobile.js"></script> <script type="text/javascript" src="cordova-2.2.0.js"></script> </head>
source share