Swipeleft / swiperight


#1

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?


(Hans-Gerd Claßen) #2

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¿


#3

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


(Mark Hunte) #4

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


(Hans-Gerd Claßen) #5

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


#6

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


(Hans-Gerd Claßen) #7

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>

#8

Thank you Hans, that’s made my day