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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:10:48+00:00 2026-05-25T02:10:48+00:00

I have one two divs (rectangle) that have each the following transforms applied on:

  • 0

I have one two divs (rectangle) that have each the following transforms applied on:

translate(100px, 100px) scale(2) rotate(20deg)

Those divs are identical except the point of origin varies, one have (0, 0) and the other have (64px, 64px). You can see them here:
http://jsfiddle.net/L7ksC/2/

How can I get the left and top difference between those tho divs?
It can be just a math solution rather then a Javascript one.

Thank you.

  • 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-25T02:10:49+00:00Added an answer on May 25, 2026 at 2:10 am

    I have a solution in a jsfiddle.

    I used the position method from jquery, to get top and left. For some angles of rotation the left value will not correspond to the top left corner, but a little trigonometry can sort that out. Please let me know if anything in the jsfiddle is unclear, I’d be happy to explain further.

    Keep in mind that the left most point of a box is not the same as the left coordinate of the top point for a 20 degree rotation. In order to calculate the left coordinate I wrote this code:

      var scale    = 2;
      var p_height = 128;
      var rotation = 20;
    
      var add_to_left =scale*p_height*Math.sin(rotation*Math.PI/180);
    

    The formula calculates the horizontal distance between the left position and the left coordinate of the top corner. Here is a much simplified fiddle showing the right triangle I am talking about.

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

Sidebar

Related Questions

I have two divs that are right above each other. The bottom one has
I have two divs, one that holds some stuff and the other with all
I have two divs, a big one and a smaller over the other, each
I have two DIVs, first one has a link in it that contains the
I have two divs that are not nested, one below the other. They are
I have two DIVs that I need to position exactly on top of each
I have two divs placed inside a larger div. Each one of these two
I have two Divs that are floated right, but I would like one to
i have two divs one floated to the left and the other to the
i have two divs with the same ids but one has display=none and the

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.