css - How can I reset the <div> class name? -
i have velocity template code generating class name on basis of loop. possible reset div name when 1 of loop iteration not match criteria. code have written:
#set ($size = $confs.size()) #set ( $prev = "mycontent" ) #foreach($i in [0..$size]) #if($i < $size) </br> <table> <tbody> <tr class="impact-soy" data-key="$confs.get($i).impact"> <div class=impact-$i> <span>$confs.get($i).impact</span> </div> #if($prev != $confs.get($i).actor) <div class=actors-$i style="margin-left: auto; margin-right: auto;"> <span>$confs.get($i).actor</span> #set ($prev = $confs.get($i).actor) </div> #else #end <script> $(document).ready(function() { $('div.impact-$i').connections({ from: 'div.actors-$i' }).length; var connections = $('connection, inner'); setinterval(function() { connections.connections('update') }, 100); }); </script> </tr> </tbody> </table> #end #end
else block should reset class name previous if block executed class name.
you can :
#set ($prev = "test") <div class=actors-$i> #if($prev != $confs.get($i).actor) <span>$confs.get($i).actor</span> #set ($prev = $confs.get($i).actor) #else //do nothing , reset div class previous true //valid condition $('.actor-'+$i).addclass('true'+$i); $('.true'+$i).removeclass('actor-'+$i).addclass('actor-'+($i-1)); #end </div>
Comments
Post a Comment