Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8158487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:36:59+00:00 2026-06-06T17:36:59+00:00

Why does following code snippet doesn’t work? It doesn’t gives any error, but also

  • 0

Why does following code snippet doesn’t work?
It doesn’t gives any error, but also it doesn’t work.
About empty object I watched here.

<script type="text/javascript">

    jQuery(document).ready(function(){
        var o = jQuery({});         
        var block = jQuery('#box');
        jQuery('#start').click(function(){
            o.queue('custom',function(next){
                block.animate({left:"+=500"},1000);
                next();
            });
            o.queue('custom',function(next){
                block.animate({left:"-=500"},1000); 
                next();
            });
            o.queue('custom',function(next){
                block.animate({top:"+=500"},1000);      
                next();
            });
            o.queue('custom',function(next){
                block.animate({top:"-=500"},1000);  
                next();
            });

            o.dequeue('custom'); 
        });
    });

</script>

UPDATE 1

If I insert console.log right before and right after dequeue call like this:

            console.log(o.queue('custom').length);
            o.dequeue('custom'); 
            console.log(o.queue('custom').length);

then I get 4 0 in console. Meaning that functions are added to the queue and therefore dequeued.

UPDATE 2

If I insert console.log right after block animate, for instance, like this:

                block.animate({left:"+=500"},1000);
                console.log('1');

then I get 1 2 3 4, which means that all 4 functions are called.

UPDATE 3

My html is very simple:

1 input button and 1 div in body tag.
div has following css:

width:200px;height:200px;display:block;background:none repeat scroll 0 0 green
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:37:02+00:00Added an answer on June 6, 2026 at 5:37 pm

    I got it working on jsbin (you can edit it with the button in the top right corner).

    You need to set position:relative on the #block element. Without it, the div will not be affected by the property changes applied, because the initial value of the property is static).

    From the MDN docs, the static position means:

    Normal behavior. The top, right, bottom, and left properties do not
    apply.

    However, the property does of course get changed for static elements, as you can see in this example (check the console). But they do not have any visible effect.

    Hope this helps. You may revert all other changes to your code I made, that was done before setting the position.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following code snippet, does the check for dic.isEmpty() result in any performance
Why does the following code give me an error (g++ 4.1.2)? template<class A> class
Why does the following code get the runtime error: Members of the Triggers collection
What does isset($_SESSION) mean? I found the following code snippet- if (!isset($_SESSION)) { //
Is there any performance penalty for the following code snippet? for (int i=0; i<someValue;
This following code snippet works in FF, IE and Chrome. However It does not
Although the following code snippet does successfully add additional guests to a google calendar
In the following code snippet, do i need to cache $(#loading) in another object
I have the following code snippet that is working find but am trying to
I have a line of PHP code that does the following: $xml = <xml><request>...[snipped

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.