Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript two versions of script on responsive site Re: two versions of script on responsive site

#93714
Mottie
Member

Hi Martinthoren!

I’m not sure how you are adding swipe support, but maybe you can just detect if swipe support exists and use it if it does. It is essentially what I did in this blog post on how to add swipe support:

var touch = "ontouchend" in document,
startEvent = (touch) ? 'touchstart' : 'mousedown',
moveEvent = (touch) ? 'touchmove' : 'mousemove',
endEvent = (touch) ? 'touchend' : 'mouseup';

This detection method is from Modernizr which is a better all around method for detecting browser support.