3

I'm using Swipe JS to create a full screen image gallery and want to add the ability to click on the left / right edge to get to the previous / next slide.

I've tried creating absolutely positioned a tags but that breaks the swipe functionality because a swipe can't be initiated on the links. To fix this I thought I could pass the event along to the correct element:

document.getElementById('next').addEventListener('touchstart', function(e){
    document.getElementById('swipe-wrap').dispatchEvent(e);
}, false);

But this throws the following error:

Uncaught InvalidStateError: Failed to execute 'dispatchEvent' on 'EventTarget': The event is already being dispatched. 

Does anyone know how to pass along the event? Or maybe a better way to do this?

Thomas
  • 8,426
  • 1
  • 25
  • 49

0 Answers0