Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery - how to write a custom queue?
    primarykey
    data
    text
    <p>i'm trying to make a custom queue, could you tell me what i'm doing wrong?</p> <p>here is a the code in action: <a href="http://dl.dropbox.com/u/1292831/hell/index2.html" rel="nofollow">http://dl.dropbox.com/u/1292831/hell/index2.html</a></p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;link rel="stylesheet" href="style/style.css" type="text/css" /&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"&gt;&lt;/script&gt; &lt;style type="text/css"&gt; .tester { background:red; width: 100px; height: 100px; left: 900px; top: 300px; position: absolute; } .counter { position: absolute; left: 0; top: 0; width: 150px; font-size: 18px; } &lt;/style&gt; &lt;script type="text/javascript"&gt; $(function(){ // animation for the 'FX' queue: $('.tester').fadeOut(1000).fadeIn(1000) // animation for the 'lolo' queue: $('.tester').queue('lolo',function(next){ $(this).animate({left: 100}, {duration:1000}) next() }) $('.tester').queue('lolo',function(next){ $(this).animate({left: 800}, {duration:1000}) next() }) .dequeue('lolo') }) // counters setInterval(function(){ var count = $('.tester').queue('fx').length $('.counter #c1').html(count) var count = $('.tester').queue('lolo').length $('.counter #c2').html(count) }, 250) &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p class="counter"&gt; items in the 'fx' queue &lt;span id="c1"&gt;&lt;/span&gt; &lt;br /&gt; items in the 'lolo' queue &lt;span id="c2"&gt;&lt;/span&gt; &lt;/p&gt; &lt;div class="tester"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </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.
    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