当您访问对话详情屏幕时,屏幕应滚动到底部。应显示最新消息。卷轴的底部不起作用......
以下是代码 - 自动滚动无法正常工作。
<script type="text/javascript">
$(document).ready(function(){
$('.conversation-wrapper').animate({
scrollTop: $('.conversation-wrapper')[0].scrollHeight},1218.15);
});
</script>
<div ng-controller="ConversationController as value">
<br>
<br>
<br>
<div class="col-lg-12">
<div class="main-box clearfix">
<header class="main-box-header clearfix">
<h2>Conversation</h2>
</header>
<div class="main-box-body clearfix">
<div class="conversation-wrapper">
<div class="conversation-content">
<span ng-repeat="message in value">
<div class="conversation-item item-left clearfix"
ng-show="{{message.whoSendTheMessage.userId!=loggedUser}}">
<div class="conversation-user">
<img src="lib/app/img/user.jpg" style="width: 50px;" alt="">
</div>
<div class="conversation-body">
<div class="name">{{message.whoSendTheMessage.firstName}} {{message.whoSendTheMessage.lastName}}</div>
<div class="time hidden-xs">{{message.sendDate |
date:'yyyy-MM-dd HH:mm:ss '}}</div>
<div class="text">{{message.content}}</div>
</div>
</div>
<div class="conversation-item item-right clearfix"
ng-show="{{message.whoSendTheMessage.userId==loggedUser}}">
<div class="conversation-user">
<img src="lib/app/img/user.jpg" style="width: 50px;" alt="">
</div>
<div class="conversation-body">
<div class="name">{{message.whoSendTheMessage.firstName}} {{message.whoSendTheMessage.lastName}}</div>
<div class="time hidden-xs">{{message.sendDate |
date:'yyyy-MM-dd HH:mm:ss '}}</div>
<div class="text">{{message.content}}</div>
</div>
</div>
</span>
<div class="conversation-new-message message-box">
<form>
<div class="form-group row">
<textarea class="form-control pull-left" rows="2" name="messagebox"
ng-model="message.content" placeholder="Enter your message..."></textarea>
<button type="submit" ng-click="saveMessage();"
class="btn btn-success fa fa-paper-plane message-button"></button>
</div>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>