What would be the true position (top, left) be of a rotated element if its height is increased by some valueObtain the Actual Left,Top position of a rotated divHow to get the position of element transformed with css rotateJavaScript/jQuery: How to get actual original position of an element (DIV) after it's been rotatedFind new left and top corresponding to original left and top on CSS rotateGetting CSS left and top when div is rotatedget div corners pixel positions after rotationHow to get original position of an element (DIV) after it's been rotated?Get default left and top position of element after rotationHow can I update the top left position after resizing a rotated object?How to preserve the bottom-right position when changing the height of a rotated dom element?
Is there any relation/leak between two sections of LM358 op-amp?
What is the white pattern on trim wheel for?
My manager quit. Should I agree to defer wage increase to accommodate budget concerns?
Does "as soon as" imply simultaneity?
Received a package but didn't order it
List of 1000 most common words across all languages
Comma Code - Automate the Boring Stuff with Python
Is it possible to encode a message in such a way that can only be read by someone or something capable of seeing into the very near future?
Symbol for function composition like a big sum
Reorder a matrix, twice
Does wetting a beer glass change the foam characteristics?
How to say "cheat sheet" in French
Is it allowed to buy a Probe Bahncard 50 repeatedly?
Going to France with limited French for a day
Averting Bathos
Research promotions in the middle of post-doc contract
Should I answer honestly if asked why I was late one day when I was actually in an interview?
Should the average user with no special access rights be worried about SMS-based 2FA being theoretically interceptable?
Can I take new (still in their boxes) PC parts in my checked in luggage?
Why did the Soviet Union not "grant" Inner Mongolia to Mongolia after World War Two?
What benefits does the Power Word Kill spell have?
Hilbert's hotel: why can't I repeat it infinitely many times?
Does the Prepare Food ability from Cook's Utensils stack?
A food item only made possible by time-freezing storage?
What would be the true position (top, left) be of a rotated element if its height is increased by some value
Obtain the Actual Left,Top position of a rotated divHow to get the position of element transformed with css rotateJavaScript/jQuery: How to get actual original position of an element (DIV) after it's been rotatedFind new left and top corresponding to original left and top on CSS rotateGetting CSS left and top when div is rotatedget div corners pixel positions after rotationHow to get original position of an element (DIV) after it's been rotated?Get default left and top position of element after rotationHow can I update the top left position after resizing a rotated object?How to preserve the bottom-right position when changing the height of a rotated dom element?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a div that is rotated at a certain angle. If I am to increase the height of the div by some value. How can I get or calculate the true top and left value of the current div and the true top and left value of the div after the height is increased at the same time. I want to calculate these values to preserve the original true bottom right position after the height is increased
JS Fiddle describes the problem that I am trying to solve
const increaseHeight = function(div)
/*
calculate the true top and left of the div
calculate the true top and left of the div after the height is increased
calculate the difference that needs to be applied such that when the height changes the original true bottom right position remains the same after the height is increased
*/
Note that I want to solve this only using javascript and no extra css applied
javascript
add a comment
|
I have a div that is rotated at a certain angle. If I am to increase the height of the div by some value. How can I get or calculate the true top and left value of the current div and the true top and left value of the div after the height is increased at the same time. I want to calculate these values to preserve the original true bottom right position after the height is increased
JS Fiddle describes the problem that I am trying to solve
const increaseHeight = function(div)
/*
calculate the true top and left of the div
calculate the true top and left of the div after the height is increased
calculate the difference that needs to be applied such that when the height changes the original true bottom right position remains the same after the height is increased
*/
Note that I want to solve this only using javascript and no extra css applied
javascript
add a comment
|
I have a div that is rotated at a certain angle. If I am to increase the height of the div by some value. How can I get or calculate the true top and left value of the current div and the true top and left value of the div after the height is increased at the same time. I want to calculate these values to preserve the original true bottom right position after the height is increased
JS Fiddle describes the problem that I am trying to solve
const increaseHeight = function(div)
/*
calculate the true top and left of the div
calculate the true top and left of the div after the height is increased
calculate the difference that needs to be applied such that when the height changes the original true bottom right position remains the same after the height is increased
*/
Note that I want to solve this only using javascript and no extra css applied
javascript
I have a div that is rotated at a certain angle. If I am to increase the height of the div by some value. How can I get or calculate the true top and left value of the current div and the true top and left value of the div after the height is increased at the same time. I want to calculate these values to preserve the original true bottom right position after the height is increased
JS Fiddle describes the problem that I am trying to solve
const increaseHeight = function(div)
/*
calculate the true top and left of the div
calculate the true top and left of the div after the height is increased
calculate the difference that needs to be applied such that when the height changes the original true bottom right position remains the same after the height is increased
*/
Note that I want to solve this only using javascript and no extra css applied
javascript
javascript
asked Mar 28 at 17:22
Akshay KumarAkshay Kumar
437 bronze badges
437 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
You can use getBoundingClientRect()
to retrieve properties of a transformed element:
var x = document.getElementById("app");
console.log(x.getBoundingClientRect());
Your fiddle should log:
DOMRect x: 17.10739517211914, y: 47.10739517211914, width: 265.78521728515625, height: 265.78521728515625, top: 47.10739517211914, …
This gives the position of the boundingclientrect which is not the actual position of the rotated div
– Akshay Kumar
Mar 28 at 19:15
Actually, if you call the function without transforming your div, it returns original values (i.e. width 200px)
– GrafiCode
Mar 28 at 23:05
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403562%2fwhat-would-be-the-true-position-top-left-be-of-a-rotated-element-if-its-heigh%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use getBoundingClientRect()
to retrieve properties of a transformed element:
var x = document.getElementById("app");
console.log(x.getBoundingClientRect());
Your fiddle should log:
DOMRect x: 17.10739517211914, y: 47.10739517211914, width: 265.78521728515625, height: 265.78521728515625, top: 47.10739517211914, …
This gives the position of the boundingclientrect which is not the actual position of the rotated div
– Akshay Kumar
Mar 28 at 19:15
Actually, if you call the function without transforming your div, it returns original values (i.e. width 200px)
– GrafiCode
Mar 28 at 23:05
add a comment
|
You can use getBoundingClientRect()
to retrieve properties of a transformed element:
var x = document.getElementById("app");
console.log(x.getBoundingClientRect());
Your fiddle should log:
DOMRect x: 17.10739517211914, y: 47.10739517211914, width: 265.78521728515625, height: 265.78521728515625, top: 47.10739517211914, …
This gives the position of the boundingclientrect which is not the actual position of the rotated div
– Akshay Kumar
Mar 28 at 19:15
Actually, if you call the function without transforming your div, it returns original values (i.e. width 200px)
– GrafiCode
Mar 28 at 23:05
add a comment
|
You can use getBoundingClientRect()
to retrieve properties of a transformed element:
var x = document.getElementById("app");
console.log(x.getBoundingClientRect());
Your fiddle should log:
DOMRect x: 17.10739517211914, y: 47.10739517211914, width: 265.78521728515625, height: 265.78521728515625, top: 47.10739517211914, …
You can use getBoundingClientRect()
to retrieve properties of a transformed element:
var x = document.getElementById("app");
console.log(x.getBoundingClientRect());
Your fiddle should log:
DOMRect x: 17.10739517211914, y: 47.10739517211914, width: 265.78521728515625, height: 265.78521728515625, top: 47.10739517211914, …
answered Mar 28 at 17:40
GrafiCodeGrafiCode
1,3722 gold badges18 silver badges19 bronze badges
1,3722 gold badges18 silver badges19 bronze badges
This gives the position of the boundingclientrect which is not the actual position of the rotated div
– Akshay Kumar
Mar 28 at 19:15
Actually, if you call the function without transforming your div, it returns original values (i.e. width 200px)
– GrafiCode
Mar 28 at 23:05
add a comment
|
This gives the position of the boundingclientrect which is not the actual position of the rotated div
– Akshay Kumar
Mar 28 at 19:15
Actually, if you call the function without transforming your div, it returns original values (i.e. width 200px)
– GrafiCode
Mar 28 at 23:05
This gives the position of the boundingclientrect which is not the actual position of the rotated div
– Akshay Kumar
Mar 28 at 19:15
This gives the position of the boundingclientrect which is not the actual position of the rotated div
– Akshay Kumar
Mar 28 at 19:15
Actually, if you call the function without transforming your div, it returns original values (i.e. width 200px)
– GrafiCode
Mar 28 at 23:05
Actually, if you call the function without transforming your div, it returns original values (i.e. width 200px)
– GrafiCode
Mar 28 at 23:05
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403562%2fwhat-would-be-the-true-position-top-left-be-of-a-rotated-element-if-its-heigh%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown