vendredi 11 septembre 2015

JS: css property and value in one variable

var trns1 = '"transition": "all 1s"';

Why doesnt that work?

$('#box').css({"transform": "translate(xy)", trns1 });

Shouldnt that be exactly the same like:

$('#box').css({"transform": "translate(xy)", "transition": "all 1s" });

?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire