0

I have an odd problem in my jQuery code that loads in Drupal 7. I used the following instruction :

(function ($) {

  Drupal.behaviors.exampleModule = {
    attach: myPopUpFunction.....

})(jQuery);

On my mac browsers this codes loads after the document is loaded however on PC the popUp loads first and then the whole page loads.

Any idea?

Thank you,

wkl
  • 77,184
  • 16
  • 165
  • 176
jax
  • 840
  • 2
  • 17
  • 35

1 Answers1

3

not sure if your issue is browser specific, but my suggestion is that you could bind the myPopUpFunction with the window's load event, in that way only after the window's elements are all loaded the popup method would be triggered invoking the popup load

$(window).bind('load', function() {
// popup load goes here
});

this should serve the cause, but the popup would load after 'all' the elements including images which might not be desired.

Note: jQuery 1.7 onward suggests method .on() instead of bind.

optimusprime619
  • 754
  • 2
  • 17
  • 38