$str = "<div>blahblahblah<b>foofoo</b><i>barbar</i></div>";
我将两部分分开
1-presentation_text
2-full content when click on read more.
$presentation = substr($str,0,23);
<div>blahblahblah<b>foo
$detail = substr($str,23);
foo</b><i>barbar</i></div>
如何在演示文稿块和详细信息块中显示格式? 我的意思是
表示块中的应为:
blahblahblah foo / * foo在这里加粗* /
详细信息块
foo barbar / * foo也加粗* /
答案 0 :(得分:1)
客户端更容易做到:
CSS
.presentation {
width: 200px;
height: 20px;
overflow: hidden;
}
.detail {
width: auto;
height: auto;
}
的Javascript
$(function(){
$('.presentation').live('click', function(){
$(this).attr('class', 'detail');
});
$('.detail').live('click', function(){
$(this).attr('class', 'presentation');
});
});
HTML
<div class="presentation">
<div>blahblahblah<b>foofoo</b><i>barbar</i></div>
</div>