tiny-slider icon indicating copy to clipboard operation
tiny-slider copied to clipboard

MouseDrag on a slide with a link element opens the target of the link

Open RobinDev opened this issue 6 years ago • 8 comments

I re-open an old issue #189

If you drag an element with a link, link is open : https://codepen.io/anon/pen/OaMLew

RobinDev avatar Dec 26 '18 15:12 RobinDev

Same issue here, and a more limited demo: https://codepen.io/anon/pen/JVgqKr

(check console)

deanc avatar May 03 '19 09:05 deanc

Since Release 2.9.0 dragging an element (in my case in a form tag > ul class="tns-slider" > li > div > input + img) produces error in Chrome Dev Tools: tiny-slider.js:2995 Unable to preventDefault inside passive event listener invocation. onPanMove | @ | tiny-slider.js:2995

If one of the tns-controls is clicked, the form is not submittet, but a request is fired to current Url with the currect active hidden input type="radio" name + value in the slide.

With Release 2.8.8 this behavior can't be reproduced

trailsnail avatar Jun 03 '19 13:06 trailsnail

Hi ! Unfortenately, I can reproduce this too... I couldn't spend more time to investigate, but I think the problem is in the function onPanEnd, that somehow doesn't prevent the event the initial click event...

But still not sure, I disabled dragging to avoid the problem.

tomablan avatar Jul 26 '19 12:07 tomablan

Hello, i had the same issue using ngx-tiny-slider.

Solved by doing this:

//.ts

mousePosition = { x: 0, y: 0 };

mouseDown($event) { this.mousePosition.x = $event.screenX; this.mousePosition.y = $event.screenY; }

onClick($event) { if (this.mousePosition.x === $event.screenX && this.mousePosition.y === $event.screenY) { //your function here... } }

//.html ngx-tiny-slider div (mousedown)="mouseDown($event)" (click)="onClick($event)" //your tags here.. div ngx-tiny-slider

GMenegatto avatar Feb 22 '21 16:02 GMenegatto

Nice but would really like a fix for the non-ngx version

t0byman avatar Oct 21 '21 13:10 t0byman

The combination of these two answers

  • https://github.com/ganlanyuan/tiny-slider/issues/753#issuecomment-1058018317
  • https://github.com/ganlanyuan/tiny-slider/issues/753#issuecomment-1041434063

fixed the problem for me.

boeckMt avatar Mar 29 '22 08:03 boeckMt

The combination of these two answers

fixed the problem for me.

⚠️ Be careful of use dragEnd, because this event is not fired when curson returns to exactly same place after dragMove

rozaljkeee avatar Feb 20 '23 09:02 rozaljkeee

I used event listener trick but sometimes it didn't triggered. Finally I switched to the Splide. It doesn't have this problem.

mostafa-norouzi avatar Aug 23 '23 08:08 mostafa-norouzi