I wonder how to concate string value and number variable in a transform property in js/jquery ?
// style.css
.btn {
scale: 1;
transform: scale(1);
}
// main.js
let mousePosY = 2
$btn.css('transform', 'scale(' +
{0.6 + `${mousePosY}` / 4} //having a typo here, need this line to be a Number(), having issues with backticks maybe?
+ ')')
2
Answers
Perhaps you meant one of these two template literals/template strings.
Assuming $btn is defined: