This should toggle the showing of the full div by clicking the actual div, you can add the click event to any trigger you want.
HTML:
<div id="blah">
Long...Content
</div>
Javascript:
$('#blah').css({height:'20px', overflow:'hidden'});
$('#blah').on('click', function() {
var $this = $(this);
if ($this.data('open')) {
$this.animate({height:'20px'});
$this.data('open', 0);
}
else {
$this.animate({height:'100%'});
$this.data('open', 1);
}
});
Showing less with javascript initially will not hide the div indefinitely for users w/o javascript enabled.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…