Streaming live at 10am (PST)

Change slide on scroll BUT do not allow to scroll past final slide

Hello everyone!

I am using the code by @Cjh o trigger a slide change on scroll by binding the scroll-wheel to the slider.

However, for my concept, I would like to limit the scroll fuctionality by not letting the user scroll past the last slide, into the first slide.

For example, one could not slide from final slide to first, or vice verca.

Is this possible to modify the script to achieve this?

<script>
        function debounce(func, wait, immediate) {
            var timeout;
            return function() {
                var context = this,
                    args = arguments;
                var later = function() {
                    timeout = null;
                    if (!immediate) func.apply(context, args);
                };
                var callNow = immediate && !timeout;
                clearTimeout(timeout);
                timeout = setTimeout(later, wait);
                if (callNow) func.apply(context, args);
            };
        }

        var onScroll = debounce(function(direction) {
            if (direction == false) {
                $("#w-slider-arrow-right").trigger('tap');
            } else {
                $("#w-slider-arrow-left").trigger('tap');
            }
        }, 200, true);

        $('#slider').bind('wheel mousewheel', function(e) {
            e.preventDefault();
            var delta;
            if (typeof event != 'undefined' && event.wheelDelta) {
                delta = event.wheelDelta;
            } else {
                delta = -1 * e.originalEvent.deltaY;
            }
            onScroll(delta >= 0);
        });
    </script>