jQuery 縮短文本插件:Shorten
Shorten 是一個可以在 DIV 中自動縮短文本并且加上“show more”鏈接的 jQuery 插件。
Shortens the text within 'element' and add a 'more' link.
$(element).shorten(); Add a link with text 'read more' while shortening the content of element.
$(element).shorten({
moreText: 'read more'
}); Change the link text to 'read more' and 'read less' overriding default value 'more' and 'less'.
$(element).shorten({
moreText: 'read more',
lessText: 'read less'
}); Override default display 100 characters and hide text above 50 characters.
$(element).shorten({
showChars: '50',
});
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!