我.toggle()
在 jquery 中对内容做了功能。但是当我点击阅读更多按钮时,文本链接消失,第一段变得不可见。
这是jQuery代码
$(document).ready(function(){
$('article p').hide();
$('article p').eq(0).show();
$('p.read-more').show();
$('p.read-more').click(function(){
$('article p').show('slow');
$('article').css('background', '#f5f5f5').show('slow');
$(this).text('Read Less');
return false;
});
})
HTML 代码
<article class="content">
<p>Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1
</p>
<p>Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1
</p>
<p>Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1
</p>
<p>Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1 Dummy Text 1
</p>
<p class="read-more">Read More</p>
</article>