我正在使用和角1,每当有新消息或单击菜单项时,我需要滚动到chatbox (div)的底部。
这是我的chatController.js中的滚动函数
//Function to scroll the chatbox to the bottom.
function scrollToBottom(){
var objDiv = new SimpleBar(document.getElementById('#simple'));
objDiv.SimpleBar.getScrollElement()
// These 2 lines of code did
此代码使滚动指示器。
你能帮我弄清楚变量scrolled是怎么计算的吗?
请解释为什么clientHeight从scrollHeight中减去,winScroll变量除以height,然后乘以100
// When the user scrolls the page, execute myFunction
window.onscroll = function() {
myFunction()
};
function myFunction() {
var winScroll = document.body.scrollTop || document.documentElemen
我有一个包含一些短语示例的div:
<div class="container">
<div class="phrase-doc">Lorem ipsum bla bla</div>
<div class="phrase-doc">Lorem ipsum bla bla</div>
<div class="phrase-doc">Lorem ipsum bla bla</div>
<div class="phrase-
请帮助我在这里,如果底部的div或完整的div是可见的,然后我想滚动到下一个div。下面是我尝试过的代码,
从数学上讲,
var top = $("#myDiv").offset().top;
//top = 1863
var divHeight = $("#myDiv").height();
//divHeight = 571
var total = top + divHeight;
//total = 2434
if($('#myDiv').css('height',total).visible(true))
{
a
我有一个带有id“页面内容”的div,它没有高度或width,它只是一个空白的div。
我用动态的内容填充div,所以div的高度在不断增长,我正在聊天,我想检测我是在div的底部还是在div总高度的最后10%,如果是的话,滚动到底部
var box = $('#page-content');
if (box.scrollTop() > (box.height*0.90))
box.scrollTop(25000); // This is the top bottom
我要做的是,检查您是否处于"#page-content" div的最后10%或更
我使用下面的脚本来执行标题中描述的操作。
<script type="text/javascript">
var jump=function(e)
{
if (e){
e.preventDefault();
var target = $(this).attr("href");
}else{
var target = location.hash;
}
$(