rviscomi / trunk8

jQuery Truncation Plugin -- THIS PROJECT IS NO LONGER MAINTAINED
MIT License
703 stars 95 forks source link

Fixed Width #41

Open mkeuschn opened 10 years ago

mkeuschn commented 10 years ago

Hi,

I need fixed width because the surrounding container is responsive (table), and sometimes empty.

I have some additions to your code.

   else if (!isNaN(width)) {
         // If there is no text do nothing
         if (str !== '') {
             bite_size = length - width;
             // If the text is to short do nothing
             if (bite_size > 0) {
                  bite = utils.eatStr(str, side, bite_size, fill);
                  this.html(bite);
                  if (settings.tooltip) {
                         this.attr('title', str);
                  }
             }
         }
   }

regards, Marko