我正在将jQuery 扩展器用于阅读更多阅读更少类型的情况,它工作正常。我想在用户点击阅读少后滚动到文章的标题。我试图弄清楚代码,但我对 jQuery 不太熟悉。
$('.expand_please').expander({
slicePoint: 1000,
widow: 2,
expandEffect: 'show',
userCollapseText: 'Read less',
expandText: 'Read more',
onCollapse: $(this).closest('h2').scroll()
});
编辑:相关HTML:
<div class="row keyline" id="show_article1">
<h2 style="margin-bottom: 1em;">TITLE</h2>
<div class="link_article" style="display: none;"><a href="/share/thomas/more/18" data-remote="true">READ MORE</a></div>
<div class="fivecol">
<img alt="thumbnail" class="thumbnail" src="/system/thumb.jpg">
</div>
<div class="sevencol last expand_please marginer"><div class="summary" style="display: none;">
ARTICLE BODY TEXT
<span class="read-less"><a href="#">Read less</a></span>
</div>
</div>