简体   繁体   English

自动滚动div元素中的内部滚动条

[英]Autoscroll for an internal scrollbar in a div element

I'm trying to do an autoscroll through javascript of an internal div which as the function of scrollbar. 我正在尝试通过内部div的javascript进行自动滚动,这是滚动条的功能。

Here the html snippet code: 以下是html代码段:

<div class="scrollpane" style="display: block;">
<div class="scrollbar" style="transform: translate(0px, 0px); height: 25px;"></div>
</div>

With the following script I'm able to move the scrollbar on the bottom (0px, 200px) but still doesn't load the data. 使用以下脚本,我可以将滚动条移至底部(0像素,200像素),但仍无法加载数据。

var scrollbar=document.querySelectorAll('div.scrollbar'); scrollbar[0].setAttribute('style','transform: translate(0px, 200px); height: 25px;');

What am I missing here? 我在这里想念什么? Maybe some event that must be fired? 也许某些事件必须被解雇? Thank you. 谢谢。

enter code here Demo: enter code here演示:
http://jsfiddle.net/subhash9/fRUUd/1511/ Code $(".scrollbar").animate({ scrollTop: 1000 }, 2000); http://jsfiddle.net/subhash9/fRUUd/1511/代码$(“。scrollbar”)。animate({scrollTop:1000},2000);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM