mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 12:09:21 +00:00
Made slimscroll more user friendly when scrolling up in conversations
This commit is contained in:
parent
1509ca3533
commit
a61e6905bc
@ -759,6 +759,9 @@ ComunicWeb.components.conversations.chatWindows = {
|
||||
//Else extract conversation informations
|
||||
var conv = this.__conversationsCache["conversation-"+conversationID];
|
||||
|
||||
//Save the position of the oldest message element
|
||||
var currOldestMessageElem = conv.messages[0].rootElem;
|
||||
|
||||
//Process the list of messages in reverse order
|
||||
messages.reverse();
|
||||
messages.forEach(function(message){
|
||||
@ -777,6 +780,13 @@ ComunicWeb.components.conversations.chatWindows = {
|
||||
|
||||
});
|
||||
|
||||
//Update slimscroll
|
||||
newScrollPos = currOldestMessageElem.offsetTop - 30;
|
||||
if(newScrollPos < 0)
|
||||
newScrollPos = 0;
|
||||
$(conv.box.messagesArea).slimScroll({
|
||||
scrollTo: newScrollPos + "px"
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user