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 - ScrollTo Effect (href to div) -

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -

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