Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Question about disabling swipe functionality on slider

Site in question:

https://tysoutdoorpower.flywheelsites.com/

u: flywheel

p: tys-outdoor

I'm using Elementor for this site and the section I'm trying to customize is the Explore by Category slider on the home page.

It currently has swipe functionality, but I would like to disable this.

I assume it uses Swiper API, but I could be wrong on this.

I found this GitHub post about disabling swipe:

https://github.com/Ember-Swiper/ember-cli-swiper/issues/72

And referred to these pages:

https://swiperjs.com/swiper-api

https://snyk.io/advisor/npm-package/swiper/example

The code I've implemented is below, however it's not working, so I must have something wrong.

<script>
Template.main.onRendered(function() {
    var mySwiper = new Swiper ('.swiper-wrapper', {
        // Optional parameters
        noSwiping: true,
                noSwipingClass: 'swiper-slide',
        }
    })
    console.log(SANCT);
</script>

I would appreciate any feedback on this.

Thank you!