Advertisement
businessdad

fpvracingproducts.com - Grid fixed size

Aug 16th, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* CSS */
  2. .short-description p {
  3.   height: 3em;
  4. }
  5.  
  6. /* JavaScript */
  7. jQuery(document).ready(function($) {
  8.   function shorten_text(selector) {
  9.     $(selector).each(function() {
  10.       var $elem = $(this);
  11.       var wordArray = $elem.html().split(' ');
  12.  
  13.       while($elem.prop('scrollHeight') > $elem.prop('offsetHeight')) {
  14.         wordArray.pop();
  15.         $elem.html(wordArray.join(' ') + '...');
  16.       }
  17.     });
  18.   }
  19.   shorten_text('.short-description p');
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement