[jQuery] Issue with $.getScript() and $(window).load() - Not working!
Hi,
Here's the thing, I'm using the SimpleModal plugin to show a modal
dialog on my page. It doesn't really matter which plugin I'm using.
Well, I think it doesn't but I haven't actually tested any other
plugins in this scenario.
When you load any page, the modal dialog will be opened at $
(document).ready(). The idea is to show a modal dialog saying that the
page is loading. Then, at $(window).load() I close the modal dialog
cause this event will be fired as soon as the page stopped loading.
The thing is, this works fine if I load the plugin (the
jquery.simplemodal.js file) in the <head> of the document with a
<script> tag but if I use $.getScript() to load the plugin, it won't
work. Well, the modal dialog will be shown, but it won't be closed at $
(window).load(), this is the problem I'm having. And yes, I'm using
callbacks with $.getScript() but I don't think it does any good
because $(window).load() will actually be called before it should...
One last thing, for Firefox, it doesn't matter if I'm loading the
plugin in the <head> or if I'm using $.getScript, it will just work.
But on IE7, it only works when the script is loaded in the <head>.
Now, my code is something like this:
$(document).ready(function() {
$.getScript("jquery.simplemodal.js", function() {
$('#simpleModal').modal();
});
});
$(window).load(function() {
$.modal.close();
});
Is there in way to fix this? I have no idea how to...