The value returned when using $.css('transform') is incorrect and displays as "rotate"

Possible Duplicate:
Retrieve -moz-transform:rotate value using jQuery

Firefox 15 - Chrome:

$('#img2').css('transform');

return =>  "rotate(90deg)"

Firefox 16

$('#img2').css('transform');

return => matrix(0, 1, -1, 0, 0, 0);

Any thoughts on how to extract the rotate value in Firefox 16? What exactly is matrix?

In Firebq I receive:

element.style {
    height: auto;
    transform: rotate(90deg);
    width: auto;
}

Answer №1

The concept of a matrix involves an affine transformation represented in the format of [a,b,c,d,tx,ty]. By converting the CSS string into an object with these properties (like [0,1,-1,0,0,0]), it becomes possible to determine the angle of rotation in degrees through the formula:

Math.atan2(matrix.b,matrix.a) * (180 / Math.PI);

For a comprehensive understanding of CSS matrices, check out this article: . Additionally, Senocular provides a great explanation on matrix transformations, despite focusing on Flash:

The syntax rotate(deg) serves as a shorthand notation for the underlying matrix transform. The discrepancy in how Firefox interprets formats is still unclear.

To delve deeper into transforms, visit: http://www.w3.org/TR/2012/WD-css3-transforms-20120911/

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The Javascript function must be executed with each page reload

Currently, I am analyzing an asp.net 2 web application that is in my care (even though I did not create it). There seems to be an issue with certain functionalities not working consistently when the page loads, particularly if using Firefox 3 within a vir ...

Tips for resizing a browser window using an HTML element

I decided to add a unique feature to my website - a handle in the bottom right corner that users can grab and drag to the left to see how the design adapts to different browser window sizes (Responsive Design). To implement this, I included the following ...

Recently updated the versions of jquery/jquery-ui, and event.stopPropagation(); is no longer functioning as expected

Seeking assistance with an issue following a jQuery upgrade. After updating jQuery to version 3.3.1 and jQuery-ui to 1.12.1, along with jquery-migrate-3.0.1.min.js inclusion, code that previously functioned now produces an error for which I'm struggl ...

Transferring items between different containers without using innerHTML

I've got an embedded <ul> within a (hidden) <aside id="idDetails">. How can I move the ul element from inside the aside and position it in a <div id="projectSide"> without using innerHTML? Any solutions in both plain JavaScript and j ...

Missing arrow icon in Bootstrap 4 navbar menu and sub menu

I am attempting to use the navbar component from Twitter Bootstrap 4 with a nested sub menu, but the arrow in the menu item that has a sub menu is not appearing at all, and I am unsure why. Here is where the arrow appears: https://i.sstatic.net/J6xI4.jpg ...

What is the best way to determine the position of an element with text content

Currently facing an issue with positioning in my project. Attached is a snapshot of my desired layout. I've tried creating a starburst effect and adding text using this code: jsfiddle link, but I'm struggling to position the elements correctly ...

polygon with five or more sides

Can divs be created with shapes such as five or six corners? I am looking to create clickable zones on a map and any alternative methods would be greatly appreciated. ...

Ways to adjust the size of the parent element based on the height of a specific element

I am faced with a situation where I need to identify all elements belonging to a specific class and adjust the padding-bottom of their parent div based on the height of the matched element. For example, consider the following structure: <div class=&ap ...

Checking for jQuery's presence in Node.jsIn this guide, we will go over how

After using npm install jquery and adding the following code to my server.js file to check if jQuery is loaded: io.sockets.on('connection', function(socket) { console.log("Connection " + socket.id + " accepted."); // Check if jQuery is ...

What are the essential files needed in Kendo UI Core for a mobile app?

Several months ago, I created a trial Kendo mobile app but now I want to verify it using the most recent version of Kendo UI Core. In my previous project, I referenced the following files: <link href="../styles/kendo.common.min.css" rel="stylesheet" / ...

Wordpress AJAX request results in a value not found

** I have added more details, thank you for your assistance so far I am in the process of implementing an AJAX search functionality on my Wordpress site to filter properties based on type, location, and status. Being a novice at AJAX, I have been followi ...

What is the best way to position a div to float or hover from the bottom after it has been

I am working on creating a menu where clicking it will reveal a submenu at the bottom, but I'm encountering an issue. Currently, in my code, the submenu is appearing from right to left before moving down. Here is my code: <meta name="viewport" co ...

Looping through multiple AJAX calls

I have come across numerous questions on this topic, but I am still struggling to find a solution that will make my code function correctly. There is a specific function for calling AJAX that I am unable to modify due to security restrictions. Here is how ...

Is there a way to specifically call the last promise in a loop?

I'm new to promises and could use some help. I have a situation where promises are resolving randomly, how can I ensure that the last promise in the loop is resolved after the full loop executes? For example, if this.selectedValues has 4 values, som ...

Resolved navigation bar problems

As a beginner in web development, I am working hard to launch my first website. Today, I have a question for the stack overflow community regarding a fixed navbar issue. The navbar I have created is functioning properly on Chrome, but when it comes to Fire ...

Adding a button to the right of a text-field input in Vuetify app

I need advice on the best way to use Vuetify in order to display a button to the right of a text-field (attached). I've checked the main site for information but couldn't find anything related to this specific scenario. https://i.sstatic.net/Pp ...

Is it feasible to place an image on top of a box?

Hello everyone, I have been trying to figure out how to achieve a specific layout in React. I am using MUI so there is no need for any hard-coded CSS. However, my attempts have not been successful so far. The layout I am aiming for consists of an image on ...

Anomaly in Form Validation with Semantic-UI

This time around, I am implementing Semantic-UI with React. In the past, I have successfully utilized Semantic-UI's form and form validation features in various projects without encountering any issues. However, a new problem has arisen, which I will ...

Guidelines for updating a value with a different value using Jquery Ajax in MVC 2

Greetings! I am currently utilizing Ajax Jquery to send a promotional code to the controller, where it will be verified, undergo some calculations, and return the result. My goal is to update the total result on the page with this new result. Below is the ...

Opacity for ghost images in HTML5 drag-and-drop interface

Is there a way to make the ghost image for draggable elements in Chrome render on a transparent background, similar to how Firefox does it? I'm seeing that in Chrome (Chromium 45), the ghost image is displayed on a white background. For Example: http ...