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 6468605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:54:19+00:00 2026-05-25T05:54:19+00:00

I have run into a pretty weird problem that I have managed to fix,

  • 0

I have run into a pretty weird problem that I have managed to fix, but in a disgusting way.

I have the following working code that grabs the left and top of the element (using MooTools). It then uses setStyles to copy these measured coordinates into the style attribute. This works pretty well.

But as soon as I set the position to absolute the values in the code above it appear to change.

Works but horrible:

var Sortable = new Class({
    initialize: function(element, container) {
        // Store the element and its settings
        this.element = element;
        this.size = element.getSize();
        this.position = element.getPosition(container);

        // Set the position
        element.setStyles({
            left: this.position.x,
            top: this.position.y
        });

        setTimeout(this.goAbsolute.bind(this), 0);
    },
    goAbsolute: function() {
        this.element.setStyle('position', 'absolute');
    }
});

As you can see, I am using a timeout to separate the left / top setting and the position setting. The following code does not work.

var Sortable = new Class({
    initialize: function(element, container) {
        // Store the element and its settings
        this.element = element;
        this.size = element.getSize();
        this.position = element.getPosition(container);

        // Set the position
        element.setStyles({
            left: this.position.x,
            top: this.position.y,
            position: 'absolute'
        });
    }
});

So, we can use this.

this.size = element.getSize();

And size.x will equal 100 for example. Then with this added line.

this.size = element.getSize();
element.setStyle('position', 'absolute');

size.x will now equal 0. Even though it was set to absolute after.

I have tried cloning the object and its values.

I have tried putting them all out of scope of each other.

Nothing seems to work.

Does anyone know of a way to do a similar fix but without setTimeout? Or is that the best way.

I have tried to explain my problem as best as I can but it is a bit of a strange one. So comment with any questions.

Thank you for any suggestions you may have.

  • 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-05-25T05:54:19+00:00Added an answer on May 25, 2026 at 5:54 am

    I’m reasonably sure (I’m not certain because you didn’t mention float: left) that you’re having the same problem as in this question, which I answered thoroughly.

    In short, you need to firstly set top and left on all the elements. After doing that, then set position: absolute on all the elements.

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

Sidebar

Related Questions

I'm pretty new to javascript and jquery, and have run into a problem that
I have run into a bit of a tricky problem in some C++ code,
I have run into this problem before but never quite solved it. I have
I have run into this problem a lot in the past, but never really
I have run into an interesting problem which I'm pretty sure is the fault
I'm pretty new to the world of pointers and have run into a problem
I have run into a pretty strange error that I can't get my head
I am pretty new to OpenGL and have run into a problem trying to
I'm building a project and I have run into the following problem: I have
I have run into a common, yet difficult problem. I do not use Photoshop

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.