简体   繁体   English

如何使用CSS3设置“阅读更多”的样式

[英]How to style “Read More” using CSS3

Here is my JQuery function below. 这是下面的我的JQuery函数。 I want to apply a CSS style to "Read More" and "Read Less" text, which are part of the function. 我想将CSS样式应用于函数的一部分“更多”和“更少”文本。 How do we do that? 我们该怎么做?

 $(document).ready(function() { $('.YourName').jTruncate({ length: 25, minTrail: 0, moreText: "Read More", lessText: "Read Less", ellipsisText: "...", }); }); 
 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript" src="http://tester3.yolasite.com/resources/javascript/jtruncate.js"></script> <p class="YourName">Hello, Text will truncate after 25 characters and a "Read More" link will be appended to it. Here is some more text. Here is some more text. Here is some more text. Here is some more text. Here is some more text. Here is some more more text. Here is some more text. Here is some more text. This is the end.</p> 

moreText: "<span class='moreText'>Read More</span>", // The text to use for the "more" link. 
lessText: "<span calss='readLess'>Read Less</span>", // The text to use for the "less" link. 

and then in your css style them as usual... 然后以您的CSS样式照常进行...

.moreText{/* styles here */}
.readLess{/* styles here */}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM