Tuesday, September 17, 2013

pageinit event in jQuery mobile

I found this which touches on the pageinit event which seems to fire off in one page jQuery mobile applications just before a transition to a new page begins. At my work, we are using it like so:

(function() {
   useJQuery();
   function useJQuery() {
      if(!window.$) {
         setTimeout(useJQuery, 100);
      } else {
         $(document).bind('pageinit', function() {
            alert('Yay!');
         });
      }
   }
})();

No comments:

Post a Comment