Swipeleft / swiperight

I want to use a simple jquery function:

$("#swipePanel").on(“swipeleft”,function(){…})

It doesn’t work and I can’t seem to concoct a suitable alternative.

Can anyone help please?

you mean jquery mobile i guess … well it should work.
it’s always good practice to post a hypefile … makes things clearer :slight_smile:

though those swipeevents are builtin so why use an external library¿

Apologies, of course a hypefile would make it clearer… Doh!
swipe.zip (173.9 KB)

As Hans mentions, you can use the Hype Native Swipe events and detect if left or right swipe by catching the event type.

console.log(event.type)
–> HypeSwipeLeftAction

you forgot to load the jQuery-mobile-library. didn’t have a look at your code … guess it’ll work when loaded.

Thank you for your reply, I’ve added jQuery-mobile-library but the swipe function doesn’t work
swipe.zip (106.3 KB)

first loaded library has to be jquery …

<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<style>
		body{
			background-color: #fff;
			margin: 0px;
			max-width: 800px;
			min-width: 320px;
		}
</style>

Thank you Hans, that’s made my day