javascript - 自动向下滚动 angularjs

标签 javascript jquery angularjs angularjs-directive autoscroll

您好,我正在使用 angularjs 创建一个聊天应用程序,当一个用户向另一个用户发送消息时,它会自动向下滚动。我不确定如何实现它,因为我的聊天窗口是一个固定的 ul 元素。我想我需要实现一个指令来执行此操作(inboxmsg-在 ul 元素上滚动)

有什么帮助吗?谢谢。

HTML

<ul class="chatting-window" inboxmsg-scroll>
    <li data-ng-repeat="messageinfo in messages">
        <div class="message-date">
            {{messageinfo[0]}}
        </div>
    </li>
</ul>

最佳答案

angularjs-scroll-glue

An AngularJs directive that automatically scrolls to the bottom of an element on changes in it's scope.

链接:https://github.com/Luegg/angularjs-scroll-glue

关于javascript - 自动向下滚动 angularjs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19871470/

相关文章:

javascript - ELEMENT.style.color 在 IE 中不起作用

javascript - 使用 javascript 对 html 列表进行排序

javascript - setInterval 显示/隐藏类的特定实例

javascript - Umask 更改 ng-minlength 的最小最大长度

javascript - Angularjs - 调用子状态时防止再次加载非抽象父状态

javascript - 重置 useState 的初始状态

javascript - 有没有办法简化这段 JavaScript 代码?

javascript - 使用 Angularjs 过滤分组内容时隐藏分组标题

javascript - 捕获 'Page Down'/'Page Up' 关键事件的问题

java - 自建API跨域错误