"JS Truncating Multiple Line Text (crop, clampin)"
Bootstrap 3.3.0 Snippet by iwebdesigner

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>JS Truncating Multiple Line Text <small>(crop, clampin)</small></h2> </div> <div class="row"> <div class="col-lg-3"> <div class="thumbnail"> <img src="http://placehold.it/250x150" alt="Image"> <div class="caption"> <h3 class="crop-text">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.</h3> </div> </div> </div> </div> </div>
var size = 20, cropContent = $('.crop-text'), cropText = cropContent.text(); if (cropText.length > size) { cropContent.text(cropText.slice(0, size) + ' ...'); }

Related: See More


Questions / Comments: