joe223 / tiny-swiper

Ingenious JavaScript Carousel powered by wonderful plugins. Lightweight yet extensible. Import plugins as needed, No more, no less.
https://tiny-swiper.js.org
1.29k stars 58 forks source link

Try to prevent default behavior while mouse dragging #47

Closed romanov closed 3 years ago

romanov commented 3 years ago

Describe the bug See the gif below (recored on https://tiny-swiper.joe223.com/docs/demo/)

https://ibb.co/zZgFxzB

Expected behavior Same as in Chrome (just works)

Information

joe223 commented 3 years ago

Hi, @romanov. Thanks for you feedback and the helpful gif.

Here are two temporary way to fix it:

  1. add css style pointer-events: none; to img tag
  2. Or replace img tag with another DOM Element, such as div. and set its background image

This is the FireFox default behavior (dragging image). I should prevent it with event.preventDefault() in touchstart/mousedown just likes this demo https://stackblitz.com/edit/tiny-swiper-issues-47?file=index.html . But here are some special scenario that default behavior should not be prevented such as button-clicking. So, I'll spend some time to get it straight.