Note that there are some explanatory texts on larger screens.

plurals
  1. POAnimate function calls multiple times
    primarykey
    data
    text
    <p>i have created a simple JavaScript file in which i have 2 images.</p> <p>here person can either swipe left or right &amp; accordingly images swipes </p> <p>here is my code,</p> <pre><code>$('#landscapeimage1').swiperight(function (event) { //here lanscapeimage1 is canvas on which i have drawn an image. var width = window.innerWidth; var slide = "+=" + width + "px"; $('#landscapeimage').animate({'left': -width}, 1, function () { $('#landscapeimage1').animate({"left": slide}, "fast", function () {}); $('#landscapeimage').animate({"left": slide}, "fast", function () { currentImage = getPreviousImage(); currentCanvas = "landscapeimage"; drawImage(); $(this).unbind(event); return false; }); return false; }); return false; }); </code></pre> <p><strong>initially when i swipe it works properly but if i visit same image then it calls same function again &amp; again until unvisited images does not comes &amp; if i have visited all images then it goes to infinite loop.</strong> </p> <p>i don't understand why this happens.</p> <p>i have tried to stop animate &amp; unbind swipe function but it also not working.</p> <pre><code>&lt;div data-role="page" id="imagepage"&gt; &lt;div class="whiteBackground" id="landscapeimage" style="position: relative;"&gt; &lt;canvas id="image" style="z-index: 1;position:absolute;left:0px;top:0px;" height="200px" width="200px"&gt; &lt;/canvas&gt; &lt;/div&gt; &lt;div class="whiteBackground" id="landscapeimage1" style="position: relative;"&gt; &lt;canvas id="image1" style="z-index: 1;position:absolute;left:0px;top:0px;" height="200px" width="200px"&gt; &lt;/canvas&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>After debugging i have found that animate function calling multiple times not swipe function but i can't figure out why? please help me out.</p> <p>does any body know why this happens?</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.
    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