複数行のテキストが溢れているので、省略記号を表示します。
2982 ワード
原文:http://www.css88.com/archives/5206
ここでjsライブラリを2つ紹介します。 Clamp.jsとjQuery.dotdotdotはとてもいいですよ。
Clamp.jsアドレス:https://github.com/josephschmitt/Clamp.js 2.475 kb(圧縮倉庫)
jQuery.dotdot住所:https://github.com/BeSite/jQuery.dotdotdot 6.15 kb(圧縮倉庫)
A jQuery plugin for advanced cross-browser ellipsi on multile line content.Demo's and documentation: http://dotdotdot.frebsite.nl
How to use the plugin
Include all nessesary.js-files inside the head-the page.
ここでjsライブラリを2つ紹介します。 Clamp.jsとjQuery.dotdotdotはとてもいいですよ。
Clamp.jsアドレス:https://github.com/josephschmitt/Clamp.js 2.475 kb(圧縮倉庫)
jQuery.dotdot住所:https://github.com/BeSite/jQuery.dotdotdot 6.15 kb(圧縮倉庫)
A jQuery plugin for advanced cross-browser ellipsi on multile line content.Demo's and documentation: http://dotdotdot.frebsite.nl
How to use the plugin
Include all nessesary.js-files inside the head-the page.
<head>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.dotdotdot.js" type="text/javascript"></script>
</head>
Create a DOM element and put some text and other HTML markp in this“wrapper”.<div id="wrapper">
<p>Lorem Ipsum is simply dummy text.</p>
</div>
Fire the plugin on DockMentReady using the wrapper-selector.$(document).ready(function() {
$("#wrapper").dotdotdot({
// configuration goes here
});
});