I have a page full of green div's.
<div class="square">1</div>
<div class="square">2</div>
<div class="square">3</div>
<div class="square">4</div>
Styled so they take up the full screen:
* {font-family: sans-serif; margin: 0; padding: 0;}
html, body {height: 100%;}
.square { background: green; float: left; height: 50%; width: 50%;}
.touch {background: red;}
When you mouseenter each div, a class of "touch" gets added to it:
$(document).ready(function(){
$('.square').bind('mouseenter', function(){
$(this).addClass('touch');
});
});
Viewing the page on my iPhone, if I touch one, it turns red (a class gets added it to it, onmouseenter). However if I drag my finger into another div, it does not not turn red (no mouseenter event triggered). I've tried every event I can find, including mobile event plugins, but I can't figure out how to get this effect. here's a jsfiddle to illustrate:
Load that on your phone, and run it. Touch one quarter and it turns red. Leaving your finger on the screen, try dragging your finger from one quarter to another. Nothing happens. What am I missing? Thanks!
UPDATE: here's a jsfiddle with jgestures.js. Load this on your phone:
http://jsfiddle.net/HdMgS/6/embedded/result/
And drag your finger from one square to another. Why do they not all turn green?
UPDATE: here's a jsfiddle with the capture from the other SO thread recommended:
Touching a square turns it red, great. But swiping into another square doesn't trigger the addClass. Am I just missing the right event?