From a564f495a7f10016fd63e63ac31d515e19180727 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 1 Apr 2016 10:20:10 +0200 Subject: improve scroll to bottom in chat --- view/tpl/chat.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view/tpl') diff --git a/view/tpl/chat.tpl b/view/tpl/chat.tpl index 4750f81fd..5afa7a029 100644 --- a/view/tpl/chat.tpl +++ b/view/tpl/chat.tpl @@ -119,7 +119,7 @@ $(window).resize(function () { else { adjustInlineTopBarHeight(); } - $('#chatTopBar').scrollTop($('#chatTopBar').scrollTop() + $('#chatTopBar').outerHeight(true)); + $('#chatTopBar').scrollTop($('#chatTopBar').prop('scrollHeight')); }); $('#chat-form').submit(function(ev) { -- cgit v1.2.3 From bbe93d0e1dc23729bcd5904810bb86f9b6b489e9 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 1 Apr 2016 10:29:58 +0200 Subject: scroll chat to bottom on fullscreen toggle --- view/tpl/chat.tpl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'view/tpl') diff --git a/view/tpl/chat.tpl b/view/tpl/chat.tpl index 5afa7a029..2da7abe34 100644 --- a/view/tpl/chat.tpl +++ b/view/tpl/chat.tpl @@ -199,10 +199,12 @@ function addmailtext(data) { function adjustFullscreenTopBarHeight() { $('#chatTopBar').height($(window).height() - $('#chatBottomBar').outerHeight(true) - $('.section-title-wrapper').outerHeight(true) - 23); + $('#chatTopBar').scrollTop($('#chatTopBar').prop('scrollHeight')); } function adjustInlineTopBarHeight() { $('#chatTopBar').height($(window).height() - $('#chatBottomBar').outerHeight(true) - $('.section-title-wrapper').outerHeight(true) - $('nav').outerHeight(true) - 23); + $('#chatTopBar').scrollTop($('#chatTopBar').prop('scrollHeight')); } function isMobile() { -- cgit v1.2.3 From 5b55726a93eb6ee94e4c23a15f18c71b511c752e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 1 Apr 2016 11:13:04 +0200 Subject: on update only jump to bottom if we actually got a new message --- view/tpl/chat.tpl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'view/tpl') diff --git a/view/tpl/chat.tpl b/view/tpl/chat.tpl index 2da7abe34..633437069 100644 --- a/view/tpl/chat.tpl +++ b/view/tpl/chat.tpl @@ -175,10 +175,9 @@ function update_chats(chats) { $('#chatLineHolder').append(newNode); $(".autotime").timeago(); - }); - var elem = document.getElementById('chatTopBar'); - elem.scrollTop = elem.scrollHeight; - + var elem = document.getElementById('chatTopBar'); + elem.scrollTop = elem.scrollHeight; + }); } function chatJotGetLink() { -- cgit v1.2.3