JAYbranding

텍스트 더 보기 토글 - jQuery

안녕하세요, content1 클래스입니다 안녕하세요, content2 클래스입니다 - 슬라이드 토글 텍스트가 길수록 좋습니다 더 길게 더욱 길게 <button id="viewmore">더 보기...</button> <style> div.content2{ background: #ccc; padding: 30px 0px; } </style> <pre data-lang="HTML"><code>&lt;div&gt;Hello, this is content1 class&lt;/div&gt; &lt;div&gt;Hello, this is content2 class - slide toggle&lt;br&gt; The long text the better&lt;br&gt;Longer&lt;br&gt;longerr&lt;/div&gt; &lt;button id="viewmore"&gt;View more...&lt;/button&gt; &lt;script&gt; $(document).ready(function(){ $("div.content2").hide(); $("button#viewmore").click(function(){ $("div.content2").slideToggle(); }); }); &lt;/script&gt;</code></pre>