简体   繁体   English

使用Javascript自动向下滚动

[英]Auto Scroll Down with Javascript

I would like you to help me make a Javascript code with autoscroll down in one particular div in one page, and while it scrolls down i want to make one procedure. 我希望您能帮助我在一页中的一个特定div中向下自动滚动来编写Javascript代码,而在向下滚动时我想创建一个过程。

Im new in javascript but i know these things to help you out 我是javascript的新手,但我知道这些东西可以帮助您

<div class="uiScrollableAreaWrap scrollable" data-reactid=".c6.0">

This is the div of the box that is scrollable. 这是可滚动框的div。

Could you give me an example of how can i make a javascript code to take this class and scroll down until the end of the Wrap?? 您能否举一个例子,说明我如何制作一个JavaScript代码来学习此类并向下滚动直到Wrap结束?

Update one. 更新一个。

http://screencast.com/t/8WNIFZB8rYG http://screencast.com/t/8WNIFZB8rYG

Check out this photo to see all the divs of the box that i want to scroll down. 查看这张照片,查看我要向下滚动的框的所有div。

Relevant SO Link 相关SO链接

Just for your case: 仅针对您的情况:

This will scroll down to bottom of the div 这将向下滚动到div的底部

var objDiv = document.querySelector("._5tee .uiScrollableAreaWrap");
objDiv.scrollTop = objDiv.scrollHeight;

DEMO 演示

Update: 更新:

based on your screenshot, Assuming that you want to scroll the ul list to the bottom. 根据您的屏幕快照,假设您要将ul列表滚动到底部。

var ulList= document.querySelector("._5tee .uiScrollableAreaWrap");
ulList.scrollTop = ulList.scrollHeight;

In case you want it for other div, use this pattern 如果您希望将其用于其他div,请使用此模式

.uiScrollableAreaWrap.scrollable yourdivselector

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

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