1

really simple question, just having a hard time actually making it work. I have a snipet of code that's javascript that I'm trying to write in jquery and can't quite get it.

effects_of_yoga_2010_INFO.style.setProperty('-webkit-transform', 
'rotateZ('+effects_of_yoga_2010_DEG+'deg)'); 

and I had tried it as

$("#effects_of_yoga_2010_INFO").css("-webkit-transform", 
"rotateZ('+effects_of_yoga_2010_DEG+'deg)"); 

but the jquery snippet doesn't work, I'd really appreciate any help I can get on this, I'm sure it'll be breeze for someone.

skunkfrukt
1,5701 gold badge13 silver badges22 bronze badges
asked Oct 4, 2012 at 11:57
0

3 Answers 3

6

It should be:

$("#effects_of_yoga_2010_INFO").css("-webkit-transform",
"rotateZ("+effects_of_yoga_2010_DEG+"deg)");

you were mixing single quotes with double quotes.

answered Oct 4, 2012 at 11:59
Sign up to request clarification or add additional context in comments.

Comments

2

Assuming effects_of_yoga_2010_DEG is another id of an element with a value, try:

$("#effects_of_yoga_2010_INFO").css("-webkit-transform", 
"rotateZ('" + $("#effects_of_yoga_2010_DEG").val() +"'deg)"); 
answered Oct 4, 2012 at 12:00

2 Comments

Why would you assume that? It is certainly not backed by the original JS code.
@Thilo - it seems to be OP's naming convention of his id's. But yes, it could also just be a js var. Too little info I guess :)
1
$("#effects_of_yoga_2010_INFO").css("-webkit-transform", "rotateZ('+effects_of_yoga_2010_DEG+'deg)"); 

That doesn't look right. Unless this was a copy-paste error you should split the variable values from the rest of the strings the same way as the JavaScript version had done.

$("#effects_of_yoga_2010_INFO").css("-webkit-transform", "rotateZ(" + effects_of_yoga_2010_DEG + "deg)"); 

Of course, this is based on not knowing what effects_of_yoga_2010_DEG is. I'm assuming it simply contains the value you are looking for and can be used the same as the JavaScript version had done.

WTK
17.1k6 gold badges39 silver badges46 bronze badges
answered Oct 4, 2012 at 12:00

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.