728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
|
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
|
+
+
+
-
|
element or forEach-capable list of elements for howLongMs, then
removes it. If afterCallack is a function, it is called after the
CSS class is removed from all elements. If called with 3
arguments and the 3rd is a function, the 3rd is treated as a
callback and the default time (addClassBriefly.defaultTimeMs) is
used. If called with only 2 arguments, a time of
addClassBriefly.defaultTimeMs is used.
Passing a value of 0 for howLongMs causes the default value
to be applied.
Returns this object but the CSS removal is asynchronous.
*/
dom.addClassBriefly = function f(e, className, howLongMs, afterCallback){
if(arguments.length<4 && 'function'===typeof howLongMs){
afterCallback = howLongMs;
howLongMs = f.defaultTimeMs;
}else if(arguments.length<3 || !+howLongMs){
howLongMs = f.defaultTimeMs;
}
if(!e.forEach) e = [e];
this.addClass(e, className);
setTimeout(function(){
dom.removeClass(e, className);
if(afterCallback) afterCallback();
}, howLongMs);
return this;
};
|