Is there any reason why this is not working:
Parent document
$(document).ready(function($) {
$('.upload-media').click(function(){
if( $(this).parent().find('iframe')[0] )
return false;
$(this).parent().append('<iframe class="media-iframe" src="'+this.href+'"></iframe>');
var ifr = $(this).parent().find('iframe');
$(document).bind('closeFrame', function(){ alert("event"); });
return false;
});
});
iFrame
$(document).ready(function() {
$("#media-frame-close").click(function(){
window.parent.$(window.parent.document).trigger('closeFrame');
return false;
});
});
Seems pretty straight forward, I've tried parent. instead of window.parent and that isn't working either :(