Scroll to End

JS(ScrollToEnd) used to work just fine, but I can't seem to get it right now. After every turn, how do you scroll to the bottom of the page after a typed response?


A hot fix to the scroll problem. Create a javascript file at the same dir, add it to your game. Add this code inside:

function scrollToEnd() {
    var scrollTo = _animateScroll ? beginningOfCurrentTurnScrollPosition - 50 - $("#gamePanelSpacer").height() : $(document).height();
    var currentScrollTop = Math.max($("body").scrollTop(), $("html").scrollTop());
    if (scrollTo > currentScrollTop) {
        var maxScrollTop = $(document).height() - $(window).height();
        if (scrollTo > maxScrollTop) scrollTo = maxScrollTop;
        var distance = scrollTo - currentScrollTop;
        var duration = _animateScroll ? distance / 0.4 : 1;
        if (duration>2000)
        $("body,html").stop().animate({ scrollTop: scrollTo }, duration, "easeInOutCubic");

The problem here is that the duration grows without limits, so you just have to put a limit (2000 is 2 seconds) in the time to scroll the entire game-page. I'm not sure if this is the problem you are facing, if not just ignore :)

This topic is now closed. Topics are closed after 60 days of inactivity.