$ (window) .load (function () event does not fire on Safari Mobile

I need to run some JQuery code after the page has finished loading, but while it works in desktop browsers, it doesn't fire an event on Safari Mobile.

This is the code:

$(window).load(function() {
   //Alert('event was fired');
});

      

I am also using JQuery Mobile ... don't know if this is related to the problem.

+3


source to share


1 answer


This script will only run when the start page is loaded, since all subsequent page navigation is AJAX based and will not fire a document ready event or window load event.

The closest match given your requirements is an event pagechange

provided by JQM. This fires after the page has loaded into the DOM and the transition animation is complete.



$(document).live('pagechange',function(){
  //your logic
});

      

+2


source







All Articles