From 5ffa7dbca702775e428d9b4ac5ba2dbf8faf92e7 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Wed, 8 Aug 2018 02:48:37 +0000 Subject: [PATCH] No autoscroll when window height is smaller than content --- webapp/titanembeds/static/js/embed.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js index 869ef2b..a604dab 100644 --- a/webapp/titanembeds/static/js/embed.js +++ b/webapp/titanembeds/static/js/embed.js @@ -1325,11 +1325,13 @@ has_handled_noscroll = true; Materialize.toast('Continue scrolling to read on...', 5000); } else { - $("main .mCSB_container").animate({ - top: -1 * ($("main .mCSB_container").height() - $(window).height()) - }, "slow", function () { - $("main").mCustomScrollbar("update"); - }); + if ($(window).height() < $("main .mCSB_container").height()) { + $("main .mCSB_container").animate({ + top: -1 * ($("main .mCSB_container").height() - $(window).height()) + }, "slow", function () { + $("main").mCustomScrollbar("update"); + }); + } } } $('#chatcontent').linkify({