Skip to content

Instantly share code, notes, and snippets.

@chayner
Created September 18, 2015 19:34
Show Gist options
  • Save chayner/49613dac7730b4cefdcc to your computer and use it in GitHub Desktop.
Save chayner/49613dac7730b4cefdcc to your computer and use it in GitHub Desktop.
mePvzp
<div class="wrapper">
<div id="mytext">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
</div>
<button id="mybutton" class="mobile-only">Read More</button>
</div>
$ ->
$('button').on 'click', ->
$('#mytext').css('max-height', '500px')
$('button').remove()
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
body {
background: gray;
}
.wrapper {
background: white;
position: relative;
width: 200px;
}
#mytext {
width: 100%;
max-height: 6em;
overflow:hidden;
}
#mybutton {
border: 0;
line-height: 2em;
position: absolute;
bottom: 0;
width: 100%;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffffff+0,ffffff+43&amp;0+0,1+43 */
background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 43%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(63%,rgba(255,255,255,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 63%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 63%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 63%); /* IE10+ */
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 43%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment