Friday, April 10, 2020

Clamp.js plugin, resolving text multi-line omitting, IE compatible and other browsers

Download
Clamp.js Project Address: https://github.com/josephschmitt/Clamp.js

Introduced


<!-- Text Multiline Omit Plugin -->
<script src="./assets/js/common/clamp.min.js"></script>


Use
Text needs to use p tag span not


// Text omitted, compatible with browsers such as IE
var newsSummary = $('.news-right-items-single-content-summary');
for (var i = 0; i < newsSummary.length; i++) {
    $clamp(newsSummary[i], { clamp: 2 });   //Show two rows
}


No comments:

Post a Comment