#how to use mouse drag to scroll horizontal?

3 messages · Page 1 of 1 (latest)

gleaming dust
#

I have this images setup to scroll horizontal this works fine but I want to be able to use my mouse to drag to scroll. Any idea how to achieve this and can this be done in Tailwindcss or do I have to make a function for it ?

<div className="flex overflow-x-auto gap-5 snap-x snap-mandatory">
            {item?.galleryimage?.map((imageitem) => (
              <div className="shrink-0 snap-center">
                <img
                  src={imageitem}
                  className="w-96 h-96 object-cover cursor-grab"
                />
              </div>
            ))}
          </div>```
mossy pier
#

For "drag to scroll" functionality I'd recommend a dedicated library for that, there's tons of those out there.

gleaming dust