M
M
Mark3212022-04-20 23:11:42
css
Mark321, 2022-04-20 23:11:42

How to change the value of transform-translate?

Help, I can’t figure out how to change the transform-translate property
I want to move the model using this property now I’m doing this, but how to do it with transforms I’m trying to do this, but it doesn’t work
player.style.top = player.offsetTop + 30 + 'px'

player.style.transform =  "translateX(" + (5) + "px)";

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sergey, 2022-04-21
@Mark321

In styles, transformations are set through variables, and in scripts, these variables are changed elem.style.setProperty(). You can try elem.style = `transform: translate( ${x}, ${y});`.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question