javascript - 如何为文本提供 readmore?

标签 javascript html css

我在 p 标签中有一段很长的文字。

        <p> type and scrambled it to make a type specimen book. 
        It has survived not only five centuries, but also the leap into  
        electronic typesetting, remaining essentially unchanged. It was   popularised 
        in the 1960s with the release of Letraset sheets containing Lorem Ipsum   passages, and more recently with desktop publishing software like Aldus      PageMaker including versions of Lorem Ipsum</P>

如果文本大于 100 个字符(例如在 whatsapp 中),我想显示一个阅读更多链接。如何实现? 我是否可以通过 pur css 来完成? 还是需要js? 它应该在 readmore 和 readless 之间切换。

最佳答案

请引用这个link .希望对您有所帮助。

关于javascript - 如何为文本提供 readmore?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37982921/

相关文章:

css - Bootstrap 4 right Column on top on mobile view

html - CSS - 要阅读的链接列表。 a:visited::before 不符合我的预期

javascript - 更改 owl-carousel 包装类?

jquery - 在隐藏的输入字段中键入内容

css - 在 React 中更改选择框选项的颜色

javascript - 从 lodash fill 与常规数组填充数组时出现不良结果

javascript - jQuery fadeIn() 应该只显示一个 div,正在显示多个 div

javascript - 为什么设置 action_controller.perform_caching = true 会破坏 javascript?

javascript - Ajax,使用div标签设置javascript值

html - 如何知道 anchor 元素使用什么字体系列