Note that there are some explanatory texts on larger screens.

plurals
  1. POhow do i capture the javascript event of dragging my finger on my iphone?
    primarykey
    data
    text
    <p>I have a page full of green div's. </p> <pre><code>&lt;div class="square"&gt;1&lt;/div&gt; &lt;div class="square"&gt;2&lt;/div&gt; &lt;div class="square"&gt;3&lt;/div&gt; &lt;div class="square"&gt;4&lt;/div&gt; </code></pre> <p>Styled so they take up the full screen:</p> <pre><code>* {font-family: sans-serif; margin: 0; padding: 0;} html, body {height: 100%;} .square { background: green; float: left; height: 50%; width: 50%;} .touch {background: red;} </code></pre> <p>When you mouseenter each div, a class of "touch" gets added to it:</p> <pre><code>$(document).ready(function(){ $('.square').bind('mouseenter', function(){ $(this).addClass('touch'); }); }); </code></pre> <p>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:</p> <p><a href="http://jsfiddle.net/HdMgS/3/" rel="nofollow" title="jsfiddle example">http://jsfiddle.net/HdMgS/3/</a></p> <p>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!</p> <p>UPDATE: here's a jsfiddle with jgestures.js. Load this on your phone: </p> <p><a href="http://jsfiddle.net/HdMgS/6/embedded/result/" rel="nofollow">http://jsfiddle.net/HdMgS/6/embedded/result/</a></p> <p>And drag your finger from one square to another. Why do they not all turn green?</p> <p>UPDATE: here's a jsfiddle with the capture from the other SO thread recommended:</p> <p><a href="http://jsfiddle.net/HdMgS/7/" rel="nofollow">http://jsfiddle.net/HdMgS/7/</a></p> <p>Touching a square turns it red, great. But swiping into another square doesn't trigger the addClass. Am I just missing the right event?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload