Lets say I would like to trigger a custom event, something like:
var foo = 5;
if(foo == 5){
event(window,'fooIsFive');
}
and then
$(window).live('fooIsfive',function(){
alert('hey! foo is five!');
});
(Please excuse my poor imagination right now.)
Is that possible? If not, is a similar approach possible?
You can, try this:
Example fiddle