javascript if function – created on other way [ 1011 views ]
Goal: to go out of box…
The if construction is simple
if(someThing == 'value'){
$(this).stop().animate({'opacity':0}, 250);
this.obj.isHidden = true;
}
Meanwhile I use the following for in many cases:
someThing == 'value' && (
$(this).stop().animate({'opacity':0}, 250),
this.obj.isHidden = true
);
But! Never use return from the comma chain!
someThing == 'value' && (
$(this).stop().animate({'opacity':0}, 250),
this.obj.isHidden = true,
return true; /* <-- NEVER! */
);
return false;
[/js]
just good to know...


