jquery - How do I integrate variable in strings (javascript) -


i trying this:

var newpositiononx = 400px;  $(".element").css("transform", "translate(0,newpositiononx)"); 

thank you!

try this:

var newpositiononx = 400; $(".element").css("transform", "translate(0, " + newpositiononx + "px)"); 

Comments

Popular posts from this blog

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

java - Reading data from multiple zip files and combining them to one -