Reputation: 221
Im trying to use Jquery to change css. The css property is kinda complicated so I'm not sure if my concatination is working or if there's another problem:
JQUERY:
$(document).ready(function() {
var degrees = Math.floor(Math.random() * 151) + 20; //this is my variable
$('#p2').css("-webkit-transform","rotate("+degrees"deg)");
// this -webkit-transform: rotate(50deg); is the property im trying to change
});
Upvotes: 0
Views: 97
Reputation: 2835
there's a small mistake. you're not appending it properly. notice the '+' after the degrees
$(document).ready(function() {
var degrees = Math.floor(Math.random() * 151) + 20; //this is my variable
$('#p2').css("-webkit-transform","rotate("+ degrees +"deg)");
// this -webkit-transform: rotate(50deg); is the property im trying to change
});
Upvotes: 1