kan*_*D.S 5 html javascript css jquery
我试图基于所选的添加类来聚焦滚动,当点击上一个和下一个按钮时,滚动需要聚焦它.我怎么能让它成为可能请检查我的小提琴 https://jsfiddle.net/kannankds/bcszkqLu/
<ul class="kds">
<li>tile dtls1</li>
<li>tile dtls2</li>
<li>tile dtls3</li>
</ul>
<input type="button" value="previous" class="previous">
<input type="button" value="next" class="next">
Run Code Online (Sandbox Code Playgroud)
添加
$(".kds").scrollTop(($(".currentSelection").index()-2) * $(".currentSelection").outerHeight());
Run Code Online (Sandbox Code Playgroud)
对于previous和
$(".kds").scrollTop($(".currentSelection").index() * $(".currentSelection").outerHeight());
Run Code Online (Sandbox Code Playgroud)
为了next