Forum Discussion

charans's avatar
charans
Community Member
2 years ago

is it possible ?

I have added a scroll panel, is it possible to make the next button enable once i scroll down to the bottom.

  • Try this.

    var scrollBox = document.getElementsByClassName("scrollarea-area");

    var jqLoader = document.createElement("script");
    jqLoader.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";

        jqLoader.onload = function() {
        jqLoader.onload = null;
        init();
    }

    document.head.appendChild(jqLoader);

    function init(){
        $(window).resize(function(){
        var newHeight = scrollBox[0].scrollHeight - scrollBox[0].offsetHeight;
        var player = GetPlayer();
        var height = newHeight;
        });

        scrollBox[0].onscroll = function(){
        var height = scrollBox[0].scrollHeight - scrollBox[0].offsetHeight;
        var player = GetPlayer();
        player.SetVar("someNum",scrollBox[0].scrollTop/height*100);
        };
    }

    Then you can set a trigger for what you want to do based on the change of "someNum" variable.

  • There's no trigger that can look for scrolling. However you could put a button at the bottom of the scroll panel that enables the Next button. If you do that, you should also include instructions telling the user that they have to scroll and then click that button to continue.