[英]Javascript scroll always on bottom
I have a div class called ".chat-scroll". 我有一个名为“ .chat-scroll”的div类。 I need that div class always on the bottom like chat. 我总是需要像聊天这样的div类。
$(".chat-scroll").animate({ scrollTop: $(document).height() }, "slow");
.chat-scroll { overflow-y: scroll; height: 200px; padding: 10px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="chat-scroll"> <ul class="messages list-unstyled"> <li><span class="text">{!! $shout->text !!}</span></li> </ul> </div>
But does not working. 但是不起作用。
I wonder why didnt you use {position:fixed} ... 我不知道您为什么不使用{position:fixed} ...
.chat-scroll {
overflow-y: scroll;
height: 200px;
padding: 10px;
position:fixed;
bottom:0;
right:0;
}
I think probably you like to practice Jquery 我想您可能喜欢练习Jquery
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.