1.p中的内容过长,当内容过长,超过两行的显示时,出现一个【展示】标签,展开之后内容最后面出现【收起】标签,类似于QQ空间发表的说说,长了显示全文,完了还可以收起来的效果,我做的无法判断内容长度,而且一行中显示的中英文字数是不等的,想有个效果完整的例子看看。
PHP中文网2017-05-15 17:04:00
Let me give you an idea. In HTML, add an inline-block (your expansion and closing) after the text. The css setting is fixed high, and overflow:hidden is exceeded. js determines the height, and adds a class to the outermost layer after exceeding it. This class controls your expansion and closing, and also clears the fixed height and overflow: hidden. Of course, if it is responsive, you have to think of another way.
曾经蜡笔没有小新2017-05-15 17:04:00
Use line-height to specify the height, and use this height to achieve folding and stretching