我正在使用 jquery 插件 dotdotdot 在一段文本之后创建“...阅读更多>>”。当用户单击链接(“阅读更多>>”)时,div 必须展开,以便整个文本可见。第一部分效果很好,但我无法弄清楚第二部分。
这是我的代码:
<script type="text/javascript" language="javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.dotdotdot.min.js"></script>
<script type="text/javascript" language="javascript">
$(function() {
$('#dot3').dotdotdot({
after: 'a#test'
});
});
<style type="text/css" media="all">
div.example {
padding: 0 0 150px 0;
}
div.example:after {
content: '';
display: block;
clear: both;
}
div.r {
width: 275px;
}
div.box {
border: 1px solid #ccc;
height: 160px;
padding: 15px 20px 10px 20px;
overflow:visible;
}
</style>
<div class="example">
<div class="r">
<div class="box after" id="dot3">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of 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.
<a href="#" id="test" onClick="">Read more »</a></div>
</div>
</div>