Reputation: 2018
I want to listen a custom event triggered from the iframe in parent window. I tried to bind event even on document and window but not succeed.
Main JS:
$(document).bind('EVENT_ANIMATION_COMPLETE', onAnimationComplete);
JS using in iframe:
$(document).trigger('EVENT_ANIMATION_COMPLETE');
Upvotes: 0
Views: 346
Reputation: 207527
Because the document
in the iframe is not equal to the document
in the parent.
There are a couple of ways to do it, one way is
parent.$(parent.document).trigger("EVENT_ANIMATION_COMPLETE");
Upvotes: 2