How can I disable the dragging and touch swiping behavior in Webflow sliders?

TL;DR
  • Add custom jQuery in the Before </body> section to disable Webflow slider touch/swipe by setting instance.touch = false.
  • Add CSS to disable pointer events on .w-slide to prevent mouse dragging.
  • Test functionality across devices to ensure swiping and dragging are fully disabled.

To disable dragging and touch swiping for sliders in Webflow, you'll need to modify the slider's behavior using custom code since Webflow's native slider settings do not offer a built-in toggle for this.

1. Use jQuery to Disable Slider Swiping

  • Add a custom script that disables swiping and dragging on the Webflow slider component.
  • This should be placed in the Before </body> tag section under Project Settings > Custom Code or inside an Embed element on the page.

2. Add the Custom Code

  • Use the following custom jQuery snippet:

  ```javascript

  <script>

    $(document).ready(function () {

      $('.w-slider').each(function () {

        var slider = Webflow.require('slider');

        var instance = slider.getInstance(this);

        // Disable swipe and drag

        if (instance) {

          instance.touch = false;

        }

      });

    });

  </script>

  ```

  • This targets each slider (.w-slider), accesses the instance via Webflow’s internal slider module, and sets touch to false.

3. Disable Mouse Drag For Slides

  • Additionally, prevent mouse dragging by disabling pointer events on slides:

  ```css

  <style>

    .w-slide {

      pointer-events: none;

    }

  </style>

  ```

  • Add this in the Inside <head> tag section of Page Settings or inside an Embed element.

4. Test Across Devices

  • Preview your site and test on desktop and mobile to ensure both touch swiping and mouse dragging are disabled.
  • If you have interactions tied to specific slides, be sure those still work as intended after disabling events.

Summary

To disable dragging and touch swipe on Webflow sliders, inject custom jQuery to turn off internal touch behavior and optionally block pointer events with CSS. This approach ensures that users cannot swipe through slides manually.

Rate this answer

Other Webflow Questions