mattbryson / TouchSwipe-Jquery-Plugin

TouchSwipe is a jquery plugin to be used with jQuery on touch input devices such as iPad, iPhone etc.
http://labs.rampinteractive.co.uk/touchSwipe/
Other
4.05k stars 1.68k forks source link

Adding Class To Dom #366

Open mralperem opened 4 years ago

mralperem commented 4 years ago

Hello I have a carousel on my website and a sidebar. I want to open the sidebar with swipe control which i have implemented succesfully but my carousel is not working properly now.

I dont want to open the menu when i swipe the carousel so could anyone please help me with the code. Thank you in advance.

$(function test() { $("body").swipe({ swipe: function(event, direction, distance, duration) { if (direction == "right") { if (carousel is not siwiped) { $("body").removeClass("sidebar-toggled"); $(".sidebar").removeClass("toggled"); } } else if (direction == "left") { if (carousel is not swiped) { $("body").addClass("sidebar-toggled"); $(".sidebar").addClass("toggled"); } } }, }); });

mattbryson commented 4 years ago

Looks like 'carousel is not siwiped' is not valid JS.

You could check the event.target to see what the user initially swiped on...