1

I am trying to print out the properties of a particular div using JQuery. I would like the various css properties to appear in an information panel on the screen.

I am trying to display scaleX but having a lot of difficulty. This is my code currently:

//Size Control
$("#slider").change(function () {
    size = $("#slider").val();
    //Update the size of box while dragging
    b1.css({
        "-webkit-transform": "scaleX(" + size / 10 + ") scaleY(" + size / 10 + ") rotate(" + rotation + "deg) rotateX("+ rotateX + "deg) rotateY("+ rotateY + "deg) skew("+ skewX + "deg," + skewY + "deg)",
    });

    $("#sizeInfo").text("Size: " + b1.css("-webkit-transform"));

});

HTML

 <div id="b1"></div>

Output in info panel

matrix3d(-0.6998933866094739, -0.012216684506098372, 0.0000000000000001224646799147353, 0, 0.012216684506098542, -0.6998933866094739, 0.0000000000000001224646799147353, 0, 0.00000000000000008421610720791067, 0.00000000000000008720833192322797, 1, 0, 0, 0, 0, 1)

Any help is much appreciated.

4
  • What is this difficultly of which you speak? Where are things going wrong? Commented Oct 23, 2013 at 20:24
  • This difficulty of which I speak is that currently this line of code $("#sizeInfo").text("Size: " + b1.css("-webkit-transform")); does not output the value of scaleX Commented Oct 23, 2013 at 20:25
  • @Javacadabra what is b1; what are rotateX et. al.? Commented Oct 23, 2013 at 20:27
  • just a basic div I've added the html Commented Oct 23, 2013 at 20:28

1 Answer 1

2

jQuery's .css wraps window.getComputedStyle which uses the computed style rather than the raw style information. You can use the style property on the element to get the actual string:

b1.get(0).style.WebkitTransform
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.