所以我有这个文本字段太大而无法显示,但你想要一个按钮来显示其余部分:
<div class="span4" >
some description..
<div class="hidden-text" style="display:none">
rest of description<br/>
</div>
<a href="#" class="btn" id="readmore"><i class="icon-chevron-up"></i> Read more</a>
<script>
$("#readmore").click(function(){
$('#hidden-text').attr('style', '');
});
</script>
</div>
为什么这不起作用,应该如何做?
编辑:
感谢演示,不幸的是我无法复制它
<div class="span4" >
some description..
<style>
.hidden-text {
display:none;
}
</style>
<p class="hidden-text">rest of description<br/></p>
<br/><br/>
<a href="#" class="btn" id="readmore"><i class="icon-chevron-down"></i> Read more</a>
<script>
$(document).ready(function(){
$('.readmore').on('click', function(){
$('.hidden-text').slideDown('slow');
});
});
</script>
</div>
我看不出与演示有什么不同...