jQuery addClass example
Change class name on click in jQuery
by mchashok
HTML
<div id="container">
<div id="step1" class="nav">
aaa
</div>
<div id="step2" class="nav>
bbb
</div>
</div>
CSS
.container{
width:100%;
position:relative;
overflow:hidden;
}
.nav{
background:red;
width:100%;
height:200px;
float:left;
position: absolute;
}
JavaScript
$( "div" ).on( "click", function() {
if ( $( this ).is( "#step1" ) ) {
$('#step1').css("left",'-='+msd);
}
else if ( $( this ).is( "#step2" ) ) {
$( "#step2" ).css("left",'-='+msd);
}
else {
$( "p" ).html( "Young Talent" );
}
$( "p" ).hide().slideDown( "slow" );
$( this ).addClass("active");
});