customer chat: hide scroll-hint when scrolled to bottom

This commit is contained in:
Felix Niklas 2016-07-05 13:01:25 +02:00
parent b7a2ba06f1
commit d002da8a64

View file

@ -685,8 +685,9 @@ class ChatWindow extends App.Controller
@scrollToBottom() @scrollToBottom()
detectScrolledtoBottom: => detectScrolledtoBottom: =>
scrollBottom = @scrollHolder.scrollTop() + @scrollHolder.height() scrollBottom = @scrollHolder.scrollTop() + @scrollHolder.outerHeight()
@scrolledToBottom = Math.abs(scrollBottom - @scrollHolder.prop('scrollHeight')) <= @scrollSnapTolerance @scrolledToBottom = Math.abs(scrollBottom - @scrollHolder.prop('scrollHeight')) <= @scrollSnapTolerance
@scrollHint.addClass('is-hidden') if @scrolledToBottom
showScrollHint: -> showScrollHint: ->
@scrollHint.removeClass('is-hidden') @scrollHint.removeClass('is-hidden')
@ -696,7 +697,6 @@ class ChatWindow extends App.Controller
onScrollHintClick: -> onScrollHintClick: ->
# animate scroll # animate scroll
@scrollHolder.animate({scrollTop: @scrollHolder.prop('scrollHeight')}, 300) @scrollHolder.animate({scrollTop: @scrollHolder.prop('scrollHeight')}, 300)
@scrollHint.addClass('is-hidden')
scrollToBottom: ({ showHint } = { showHint: false }) -> scrollToBottom: ({ showHint } = { showHint: false }) ->
if @scrolledToBottom if @scrolledToBottom