Horizontal Locomotive scroll not working on mobile

1.3k views Asked by At

I'm using Locomotive scroll library to animate gallery view horizontaly on scroll. Problem is mobile view.

See the demo: DEMO

 const lscroll = new LocomotiveScroll({
    el: document.querySelector("[data-scroll-container]"),
    smooth: true,
    direction: "horizontal"
  });

See the code: CODE

2

There are 2 answers

1
Vishnu Varthan On
const lscroll = new LocomotiveScroll({
    el: document.querySelector("[data-scroll-container]"),
    smooth: true,
    direction: "horizontal",
    smartphone: {
      smooth: true,
      direction: "vertical" //use the direction according to your need//
    },
    tablet: {
      smooth: true,
      direction: "vertical" //use the direction according to your need//
    },
});
1
bguillaume On

You can set breakpoint values (min width for the locomotive scroll to take effect) to 0.

const lscroll = new LocomotiveScroll({
    el: document.querySelector("[data-scroll-container]"),
    smooth: true,
    direction: "horizontal",
    mobile: {
      breakpoint: 0,
      smooth: true,
      direction: "horizontal",
    },
    tablet: {
      breakpoint: 0,
      smooth: true,
      direction: "horizontal"
    },
});