Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
Slider to change slides on scroll

I am trying to implement the following setup:

When a user scrolls down my web page, I want scroll to function normally, until they reach a section where I have a slider. Once this section is in the viewport, the website should stop scrolling down the page, and the slider should scroll from slide 1 to slide 2. When the slides are finished, the page should continue to scroll as normal again.

The same should happen when the user is scrolling from bottom to top.

https://project-1-6122b1.webflow.io/slider

I have gotten it to mostly work on desktop, but unfortunately, it does not work on Mobile. The slides also just infinitely scroll. After slide 2, the page should cacrry on scrolling as normal.

<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>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!