我真的被困在这一个...动态高度tinyscrollbar
我在div上使用tinyscrollbar.js插件。在该div里面,我有一个视口,其中包含一个段落和一个按钮,用于切换500px和1000px之间的段落高度。我如何动态更新tinyscrollbar以注意到新高度并自行更正? (请想象有其他九个“box_content review”div)
我尝试使用网站建议的tinyscrollbar_update方法,但它似乎不起作用。有人有想法吗?
感谢
HTML -
<div id="scrollbar3">
<div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>
<div class="viewport">
<div class="overview">
<div class="box_content review">
<h5 class="reviewTitle">Review title: D90 is the best camera</h5>
<img src="../../images/gen_rating_5.png" />
<div class="topCont">
<img src="../../images/profile.png" />
<p class="pros">Pros - LightWeight, Quality, Performance, Durable, Reliable </p>
<p class="cons">Cons - Expensive, Interchangable Parts </p>
</div>
<p class="reviewContent">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...   <span><i><a class="readMore">read more</a></i></span></p>
</div>
</div>
</div>
</div>
jQuery的 -
$('#scrollbar3').tinyscrollbar({ sizethumb: 45 });
$(".readMore").toggle(function(){
$(this).parent().parent().parent().animate({height:530},400);
$('#scrollbar3').tinyscrollbar_update();
},function(){
$(this).parent().parent().parent().animate({height:76},400);
$('#scrollbar3').tinyscrollbar_update();
});
请提供一些标记 – 2013-04-11 12:11:27
只是一个想法,如果“tinyscrollbar_update” &&如果你正确地使用这一切,那么替代方法是让父元素克隆前,它初始化tinyscrollbar,然后resize函数,在父元素之后插入原始克隆的克隆,移除父元素,并在新插入的克隆上再次建立tinyscroll。或者使用jQuery的[replaceWith方法](http://api.jquery.com/replaceWith/) – SpYk3HH 2013-04-11 12:14:00
为什么不在切换高度后重新初始化tinyscrollbar? – 2013-04-11 12:15:11