我使用jquery和html代码在我的网站上使用展开折叠:
<script>
$(document).ready(function () {
$('.fulltext').hide();
$('.blog-item .readmore').click(function (event) {
event.preventDefault();
$(this).parent().find('.fulltext').slideToggle('slow');
$(this).text($(this).text() == 'Close Deals' ? 'More Deals' : 'Close Deals');
});
});
</script>
HTML:
<div class="blog-item">
<p class='fulltext'>Read more text will be here.</p>
<a class="readmore" href="#">Read more..</a>
</div>
实际上我想在隐藏文本中使用表格,现在是:<p class='fulltext'>Read more text will be here.</p>
但是当我在fulltext中使用table时它停止工作。请任何建议。
答案 0 :(得分:1)
将<p class="fulltext">
更改为<div class="fulltext">
,它应该可以正常工作。您不能在<p>
。
答案 1 :(得分:0)
<div>
元素用于描述数据容器,而<p>
元素用于描述内容段落。要使用内部使用div
标记的表格。