dynamicweb / swiffy-slider

Super fast carousel and slider with touch for optimized websites running in modern browsers.
MIT License
250 stars 29 forks source link

If "Mouse draggable" is set, swiping on mobile does not work #19

Closed Grienauer closed 2 years ago

Grienauer commented 2 years ago

Currently if "Mouse draggable" is set, it is not possible on mobile phones to drag the slider. I think is a problem and UX could be improved

Describe the solution you'd like For a better/expected UX it should still be possible to swipe on smartphones even if the setting "Mouse draggable" is set.

Thank you!

nicped commented 2 years ago

Hi

Great find - thank you for observing.

I have a possible solution ready for this issue that will use a @media (hover: hover) to encapsulate the slider-nav-mousedrag selectors in the CSS so that the dragging area will only get rendered if the primary pointer device can hover like a mouse.

The result will be like this:

.slider-nav-mousedrag .slider-container {
    cursor: grab;
}

.slider-nav-mousedrag .slider-container.dragging {
    scroll-snap-type: unset;
    scroll-behavior: unset;
    user-select: none;
}

@media (hover: hover) {
    .slider-nav-mousedrag .slider-container::after {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
    }
}

Let me know if you have any comments - otherwise

Grienauer commented 2 years ago

We testet it. Drag works on all screen-sizes. will there be a new release soon with this changes?

nicped commented 2 years ago

Thanks for testing and confirming it works. I have pushed a 1.4.1 release where this issue is fixed! Thank you for using Swiffy slider and taking the time to report this issue.