Select2 Demo
by dhavaljani
HTML
<link rel="stylesheet" href="http://ecos.fws.gov/js/bootstrap-2.0.3/css/bootstrap.css">
<script src="http://ivaynberg.github.com/select2/select2-master/select2.js"></script>
<link rel="stylesheet" href="http://ivaynberg.github.com/select2/select2-master/select2.css">
<div class="wrapper">
<div class="collapse">
<a href="#">Click to read more</a>
<p>Lorenter code hereem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
</div>
CSS
.wrapper {
bottom: 0;
position: absolute;
}
.collapse a, .expand a {
float: right;
display: inline-block;
width: 160px;
background: #333;
color: #fff;
text-align: center;
margin: 0 10px;
}
.collapse {
height: 20px;
overflow:hidden;
}
.expand {
height: auto;
}
JavaScript
$(document).ready(function()
{
$('.wrapper').find('a[href="#"]').on('click', function (e) {
e.preventDefault();
this.expand = !this.expand;
$(this).text(this.expand?"Close":"Click to read more");
$(this).closest('.wrapper').find('.collapse, .expand').toggleClass('collapse expand');
});
});