jQuery addClass example
Change class name on click in jQuery
HTML
<div class="wrapper">
<div class="box box-1">1</div>
<div class="box box-2">2</div>
<div class="box box-3">3</div>
</div>
CSS
* {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.wrapper {
position: relative;
}
.box {
width: 70%;
height: 100px;
background: blue;
outline: 3px solid black;
color: #fff;
font-size: 50px;
}
.box-2 {
width: 29%;
height: 200px;
position: absolute;
right: 0;
top: 0;
background: lightblue;
}
@media screen and (max-width: 540px) {
.box {
width: 100%;
height: 100px;
}
.box-2 {
position: static;
}
}