1

I am having trouble with a jQuery plugin in jQuery Mobile. In jQuery mobile all links are loaded via AJAX by default, which is great but my plugin stops working with AJAX enabled. If I disable it, my plugin works again.

The app can be found here. You must visit the app on an iPhone and "Bookmark to the Homescreen" for the issue to appear.

Login details are:

USER:chrisb
PASS:120521pot

The app I'm building is for iOS and needs to run in full screen mode, and AJAX is a must for full screen to work properly. I know the scripts are being run because I have an alert embedded in the JS function to show me it has run and if I remove any of the JS files associated with the plugin then the page is blank and nothing is loaded.

I'm not sure if the plugin, jQuery Mobile or my custom js that is breaking it but if I load the page without AJAX everything runs fine.

Any help is much appreciated, I am banging my head on this one...

Community
  • 1
  • 1
Chris Burk
  • 11
  • 2
  • Oh, I forgot to mention that my issue is on the stats page, I am trying to get graphs to load, page is located here: [link](http://cburk.com/kah/stats.php). – Chris Burk Oct 25 '11 at 16:30
  • and here is the link to the plugin I am trying to use: – Chris Burk Oct 25 '11 at 17:54
  • [Graphs Plugin](http://www.filamentgroup.com/lab/update_to_jquery_visualize_accessible_charts_with_html5_from_designing_with/) – Chris Burk Oct 25 '11 at 17:55
  • I found my solution [here][1] [1]: http://stackoverflow.com/questions/5332772/how-to-execute-javascript-after-a-page-is-transitioned-with-jquery-mobile – Chris Burk Oct 26 '11 at 02:05
  • http://stackoverflow.com/questions/15800121/why-i-have-to-put-all-the-script-to-index-html-in-jquery-mobile/15806954#15806954 – isaax2 Sep 27 '13 at 14:30

1 Answers1

0

For plugins to work inside jQuery Mobile, I hooked into the pageshow event and then target the currently active page via .ui-page-active selector:

$(document).on('pageshow', function(e, ui) {
    $('div.ui-page-active .my-element').myPlugin();
});
underblob
  • 946
  • 9
  • 10