javascriptjqueryhtmlhyperlinkflickity

Link click issue with flickity JS plugin


I want to know when the user starts the navigation to a new page by clicking in a link located inside my Flickity slider. I have attached the jQuery click event on the links, but when the user slides and click at the same time, the click event on the <a> is triggered but the navigation to the link adress does not occur.

Demo : http://codepen.io/anon/pen/GoapaY . To reproduce the issue : click down on the link, then slide, then release your click : the event is triggered but the navigation to example.com have not occured.

Which event/trick can I use to know when the user actually navigate to the link adress ?


Solution

  • Answer obtained with this issue opened on Flickity's GitHub :

    This is the intended behavior. This allows users to slide the gallery using any element on the page, links, buttons, etc. It lets click events propagate. There's additional logic so that static clicks do trigger a click on the element, and allow links to go through if no sliding occurred. Flickity's staticClick event might be what you're looking for.