truncate fit container height - Free Download Truncate Text To Fit Its Container's Height - LC Text Shortener

Free Download Truncate Text To Fit Its Container’s Height – LC Text Shortener

Posted on

This time I will share jQuery Plugin and tutorial about Truncate Text To Fit Its Container’s Height – LC Text Shortener, hope it will help you in programming stack.

truncate fit container height - Free Download Truncate Text To Fit Its Container's Height - LC Text Shortener
File Size: 8.37 KB
Views Total: 95
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Just another jQuery text truncation plugin for shortening text based on its container’s height or a fixed height value.

See Also:

How to use it:

1. Load the LC Text Shortener plugin’s files after jQuery library and we’re ready to go.

1 <script src="/path/to/cdn/jquery.slim.min.js"></script>
2 <script src="/path/to/lc_text_shortener.min.js"></script>

2. Call the function on the container whose text will be dynamically truncated based on its height.

1 <section id="shortened_txt">
2   Text Block Here
3 </section>
1 $(function(){
2   $('#shortened_txt').lc_txt_shortener();
3 });

3. Specify the character(s) displayed at the end of the text after it has been truncated.

1 $(function(){
2   $('#shortened_txt').lc_txt_shortener('[..]');
3 });

4. Truncate the text to a specific height instead (300px in this example).

1 $(function(){
2   $('#shortened_txt').lc_txt_shortener('[..]', 300);
3 });

5. Determine which HTML tags have to be maintained during shortening.

1 $(function(){
2   $('#shortened_txt').lc_txt_shortener('[..]', 300, 'strong, a , em');
3 });