まだデータがありません。
もっとみるを簡単に実装できる「Show More」
当ページのリンクには広告が含まれています。
スポンサーリンク
もっとみるをjQueryで簡単に実装できるプラグイン「Show More」を紹介します。
jQueryプラグイン「Show More」
今回紹介するプラグインは、もっとみるを簡単に実装できるプラグイン。その名も「Show More」です。しかも、ふわっとしたアニメーション付きなので、いいね!
スポンサーリンク
デモのページにある「» もっとみる」をクリックすると隠れた段落が表示され、「» もっとみる」は非表示になり、代わりに「» もっとみない」が表示されます。これをクリックすると「» もっとみる」をクリックして表示された部分が非表示になり元に戻ります。
デモのソース(HTML + jQuery)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="Show More のデモでーす。">
<title>Show More - jQuery Plugin Demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/jquery.showmore.min.js"></script>
<script>
$(document).ready(function() {
$('.showmore').showMore({
speedDown: 300,
speedUp: 300,
height: '100px',
showText: '» もっとみる',
hideText: '» もっとみない'
});
});
</script>
<style>
#wrapper { width:960px; margin:0 auto; padding:50px 0 0 0; }
/* Shore more styles */
.showmore { line-height:18px; font-size:12px; padding:15px; margin:0 0 20px 0; }
.showmore p {margin: 0 0 10px0 ;}
.showmore_content { position:relative; overflow:hidden; }
.showmore_trigger { width:100%; height:45px; line-height:45px; cursor:pointer; }
.showmore_trigger span { display:block; }
</style>
</head>
<body>
<p><a href="https://webkaru.net/jquery-plugin/show-more/">「jQueryプラグインまとめ」に戻る</a></p>
<h1>Show Moreのデモでーす。</h1>
<div id="wrapper">
<div class="showmore">
<p>
あいうえお<br />
かきくけこ<br />
さしすせそ<br />
たちつてと<br />
なにぬねの<br />
</p>
<p>
はひふへほ<br />
まみむめも<br />
やゆよ<br />
らりるれろ<br />
わ
</p>
</div><!-- .block -->
</div>
</body>
</html>
スポンサーリンク