Skip to main content

.animate() queue option explanation



from http://api.jquery.com/animate/ :







queue: A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string.







I want that the animations added to an object should be start when the last animation ends. From the jquery doc it seems to me that, in order to achieve this, the animation must added to a queue. if I pass {queue: true} the animation is added to the general queue, while in jQuery 1.7 I can pass {queue: "queue_foo"} to add the animation to a certain queue. I wrote this in my code, but the animation is not executed.







showedSlide.animate({

left: -showedSlide.outerWidth()

}, {queue: "left"});




Comments

  1. The default queue ('fx') gets dequeued immediately whenever a new action gets queued, custom queues do not. You have to dequeue() them yourself.

    I suspect, however, that you tried the default queue, it didn't work and so you turned to custom queues, because unless you specify queue: false animations do get queued up, and the next animation waits for the previous one to complete before it can begin. But this only applies to animations on a single element. If you have 2 animations on 2 different elements, they'll execute in parallel.

    Does your showedSlide always refer to the same element or does it change?

    ReplyDelete

Post a Comment

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.