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">ince its creation in 2001, Wikipedia has grown rapidly into one of the largest reference websites, attracting 374 million unique visitors monthly as of September 2015.[1] There are about 71,000 active contributors working on more than 47,000,000 articles in 299 languages. As of today, there are 5,663,231 articles in English. Every day, hundreds of thousands of visitors from around the world collectively make tens of thousands of edits and create thousands of new articles to augment the knowledge held by the Wikipedia encyclopedia. (See the statistics page for more information.)</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 {
margin: 20px auto 0;
width: 600px;
background: #ccc;
padding: 20px;
position: relative;
}
.box {
width: 330px;
min-height: 200px;
background: blue;
outline: 3px solid black;
color: #000;
font-size: 12px;
}
.box:not(:last-child) {
margin-bottom: 20px;
}
.box-2 {
width: 210px;
position: absolute;
right: 20px;
top: 20px;
padding: 10px;
background: lightblue;
}
@media screen and (max-width: 540px) {
.box {
width: 100%;
height: 100px;
}
.box-2 {
position: static;
}
}