removeclass - Remove multiple classes from multiple elements with jquery -
this $ code , and animate.css linked in jsfiddle link adds animation effects boxes or images.
$('.box1').addclass('animated bounceinup');
adds animated class , effect class.
$('.box1').removeclass('animated bounceinup');
removes classes.
the problem here i'm planning utilize not less 100 boxes/images, there should way add/remove animated , effect classes @ same time.
this code i'm using , jsfiddle:
jsfiddle
$(document).ready(function () { $('.box1').addclass('animated bounceinup'); $('.box2').addclass('animated bounceinleft'); $('.box3').addclass('animated flipinx'); // var wait = window.settimeout(function () { $('#boxes *').removeclass('animated'); }, 3300); });
however removes animated classes elements (all effect different) can't add together new effect classes. couldnt figure out add together animated in '.removeclass('animated')'. in advance.
update: reassigning class attribute erases classes after initial class .box1
, .box2
, etc.
$(function () { $('.box1').addclass('animated bounceinup'); $('.box2').addclass('animated bounceinleft'); $('.box3').addclass('animated flipinx'); // var wait = window.settimeout(function () { $('#boxes > div').each(function(){ this.classname = this.classname.split(' ')[0]; }) }, 3300); });
using straight javascript this.classname
faster jquery method.
as long immediate kid divs
of #boxes
element indeed boxes selector $('#boxes > div')
fine.
updated fiddle: http://jsfiddle.net/ruhpf/18/
jquery removeclass
No comments:
Post a Comment