I am trying to get a plugin to run on JQM, but I need it to wait and load when page two is active. Right now, its loading when it starts up. I have my pages set up with data-role='page'
. Here is my code:
$(document).ready(function(){
$("#two").bind('pageinit')
jQuery(".namesleft").fitText();
jQuery(".scoreleft").fitText();
jQuery(".namesright").fitText();
jQuery(".scoreright").fitText();
});
thanks in advance for the help
Here's a working jsFiddle example: http://jsfiddle.net/Gajotres/F2Gcm/
On method should be used instead of live method to bind a page event, live method is deprecated and don't exist in jQuery 1.9+.
Also this should be bound to pageshow event because it wont work in any other case. jQuery Mobile is strict with plugins doing visual changes, that kind of plugins will work only in pageshow event.
If you want a better understanding of jQuery Mobile page events take a look at this ARTICLE, or find it HERE.