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.

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.

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)"); 

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.

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.