HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/komma.pro/resources/assets/js/site/scrollableWebsite.js
/* ==========================================================================
   Scrollable website component on case-detail
   ========================================================================== */

var ScrollableWebsite = {

    init : function(){

        // Define scroller
        var $scroller = $('.sw-scroller');
        // Maximum scrollable distance
        var max = $scroller.height() - $scroller.parent().height();
        // Scroll ease (https://greensock.com/customease)
        CustomEase.create("ScrollEase", "M0,0,C0.11,0.494,0.144,0.661,0.222,0.822,0.296,0.974,0.504,1,1,1");

        // Scrolling animation Todo: customizable scroll-points
        var tl = new TimelineLite();
        tl.from($scroller, 2, { y:0 },"+=.5");
        tl.to($scroller, 2, {ease: "ScrollEase", y:'-' + (max*.4)});
        tl.to($scroller, 2, {ease: "ScrollEase", y:'-' + (max*.5)});
        tl.to($scroller, 2, {ease: "ScrollEase", y:'-' + (max*.85)});
        tl.to($scroller, 2, {ease: "ScrollEase", y:'-' + max},"+=0.3");
        tl.to($scroller, 3, {ease: "ScrollEase", y:0, onComplete: function()
        {
            // Restart after last tween
            tl.restart()
        }});
    },
};