[jQuery] accessing iframe window object
I have a set of iframes which are accessed the following way
(example):
$('#' + windowID + 'Frame').load(
function() {
$('#' + windowID + 'Loader').css('display', 'none');
}
);
This sets a loader image to hide once the document in the iframe has
loaded.
What I would like to do, is display the loader image the instant the
source of the iframe changes.
So I was trying something like:
$('#' + windowID + 'Frame').unload(
function() {
$('#' + windowID + 'Loader').css('display', 'block');
}
);
However, this isn't working because I guess the iframe itself isn't
actually being unloaded, it's the document within the iframe that is
being unloaded. If I do something like:
$(window).unload( function() {
alert('unloaded');
});
in the source page of the iframe, the message is correctly displayed,
however I would like to do this from the parent page.
How can I access the iframe document's window object from the parent?
Can anyone see a better way of doing this?