Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use .bind() in my function
    primarykey
    data
    text
    <p>I have a function that is advancing scrolling images on a webpage. It can be seen here:</p> <p><a href="http://leadgenixhosting.com/~intmed/" rel="nofollow">http://leadgenixhosting.com/~intmed/</a></p> <p>The right arrow is what you click to advance the images. I have this problem where I have used .unbind() so that the arrow is unclickable until the images have finished with .animate() so that they don't get out of sync. But I'm not exactly sure how to use .bind() to make the arrow clickable again.</p> <p>This is what the function currently looks like:</p> <pre><code>$('#in-right').click( function(){ $('#in-right').unbind('click'); imageSwitch(); $('#in-right').bind('click'); } ); </code></pre> <p>I'm obviously implementing bind incorrectly. How can I implement it right?</p> <p>Here is my imageSwitch() function:</p> <pre><code>function imageSwitch(){ current++; current_image++; previous_image++; next++; two_prev++ if(two_prev &gt;= divs.length){ two_prev = 0; } if(current &gt;= gallery_images.length){ current = 0; } if(previous_image &gt;= divs.length){ previous_image = 0; } if(current_image &gt;= divs.length){ current_image = 0; } if(next &gt;= divs.length){ next = 0; } $('#'+divs[current_image]+'').animate({left:'-=1020px'},{queue:false,duration:1000}) $('#'+divs[current_image]+'').css('background-image','url('+gallery_images[current]+')'); $('#'+divs[previous_image]+'').animate({left:'-=1020px'},{queue:false,duration:1000}); $('#'+divs[next]+'').animate({left: '+=1020px', top: '-=10000px'}, 1000); $('#'+divs[two_prev]+'').animate({left: '+=1020px', top: '+=10000px'}, 1000); } </code></pre>
    singulars
    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