Tutorial :JQuery $(document).onClick doesn't work when clicking an flash on IE (but it does in FF)



Question:

This is the scenario:

I'm developing a dropdown widget in Jquery. I have to say it was simple.

The main problem was to catch when the user clicks outside my widget to make it hide its list. I found this code here:

onClickOutside : function(event, e){    var thisObject = this;    var clickedOutside = true;     // check if the object itself or its parents are seoDropDown ones.    $(e).parents().andSelf().each(function () {      if (this == thisObject) {        clickedOutside = false;         return false;       }    });    if (clickedOutside) {      //hide my widget    }  },  

and it works fine; I bind this to my object like

myWidget.bind("onClickOutside", myWidget.onClickOutside);  

and then trigger it using

$(document).click(function (e) {    $(myWidget).trigger('onClickOutside', [e.target]);  });  

Everything works fine EXCEPT if I click an swf movie inside an embed tag in IE.

I'm pretty sure swf's in IE can send some message to javascript, because YUI menu is capable of hiding perfectly even if the outside click was done over a swf object so...... does anybody knows how YUI menu widget is capable of "listening" clicks inside swfs in IE?

Thanks!


Solution:1

Prior art: use onmousedown / onmouseup.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »