Skip to content

Instantly share code, notes, and snippets.

@mikeyakymenko
Last active December 15, 2015 22:19
Show Gist options
  • Save mikeyakymenko/5331981 to your computer and use it in GitHub Desktop.
Save mikeyakymenko/5331981 to your computer and use it in GitHub Desktop.
jQuery для смены многих класов по клику.
<script type="text/javascript">
$(function(){
$('.ex_sortlink2 a').click(function(){
var state = this.className;
state = state.split('state');
state = state[1];
state = parseInt(state);
state = (state + 1) % 5;
this.className = "state" + state;
return false;
});
})
</script>
<div class="ex_sortlink2">
<a href="" class="state0">Цвета</a>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment