jQuery on click
Change class name on click in jQuery
by Jithin Raj P R
HTML
<div id="menu"><a href="#">menu</a></div>
<div id="circle">
<span class="content"><a href="index.html">home</a><br />
<a href="pricing.php">pricing</a><br />
<a href="gallery.php">gallery</a><br />
<a href="contact.php">contact</a><br />
</span>
</div>
CSS
body {
padding: 20px;
}
.circle,.content {
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 2s ease-in-out;
-ms-transition: all 2s ease-in-out;
transition: all 2s ease-in-out;
}
#circle {
background: rgba( 99, 99, 99, 0.8 );
box-shadow: 1px 2px 2px rgba( 0, 0, 0, 0.8 );
border-radius: 100%;
color: white;
text-align: center;
font-family: sans-serif;
padding: 20px;
overflow: hidden;
-webkit-transform: scale( 0.1 );
-moz-transform: scale( 01 );
-o-transform: scale( 0.1 );
-ms-transform: scale( 0.1 );
transform: scale( 0.1 );
width: 400px;
height: 400px;
line-height: 400px;
}
.circle-grow {
-webkit-transform: scale( 1 );
-moz-transform: scale( 1 );
-o-transform: scale( 1 );
-ms-transform: scale( 1 );
transform: scale( 1 );
vertical-align: middle;
}
.content {
opacity: .1;
}
.circle-grow .content {
opacity: 1;
}
JavaScript
// find elements
$("#menu").click(function(){
$("#circle").addClass("circle-grow");
});