Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

用angular1写的一个聊天软件,监听聊天内容模型变化(有新的聊天内容),然后使聊天内容显示框的滚动条自动定位到底部。但是如果用户正在查看聊天内容,滚动条还会定位到底部就会很奇怪。有没有当前div被选中的事件来解决这个问题呢?图片描述


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
565 views
Welcome To Ask or Share your Answers For Others

1 Answer

在数据更新之前判断滚动条的位置,如果滚动条在底部则更新数据后滚动条再次定位到底部,否则就说明用户滑动了聊天界面,不再进行滚动


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...