From d002da8a640472d96fa960bcb1bc3715f7eb7fa6 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Tue, 5 Jul 2016 13:01:25 +0200 Subject: [PATCH] customer chat: hide scroll-hint when scrolled to bottom --- app/assets/javascripts/app/controllers/chat.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/chat.coffee b/app/assets/javascripts/app/controllers/chat.coffee index 20c4b809d..0f1077776 100644 --- a/app/assets/javascripts/app/controllers/chat.coffee +++ b/app/assets/javascripts/app/controllers/chat.coffee @@ -685,8 +685,9 @@ class ChatWindow extends App.Controller @scrollToBottom() detectScrolledtoBottom: => - scrollBottom = @scrollHolder.scrollTop() + @scrollHolder.height() + scrollBottom = @scrollHolder.scrollTop() + @scrollHolder.outerHeight() @scrolledToBottom = Math.abs(scrollBottom - @scrollHolder.prop('scrollHeight')) <= @scrollSnapTolerance + @scrollHint.addClass('is-hidden') if @scrolledToBottom showScrollHint: -> @scrollHint.removeClass('is-hidden') @@ -696,7 +697,6 @@ class ChatWindow extends App.Controller onScrollHintClick: -> # animate scroll @scrollHolder.animate({scrollTop: @scrollHolder.prop('scrollHeight')}, 300) - @scrollHint.addClass('is-hidden') scrollToBottom: ({ showHint } = { showHint: false }) -> if @scrolledToBottom