Difficult for me to test because I'm away from home, but if you're looking to check what the CSS value is, you could use getComputedStyle.
element.style.right=// we get the value "450px" from getComputedStyle, // and slice off the px to create a number.Number(getComputedStyle(element).right.slice(0,-2))+(timePassed/5)+"px";
Or, alternatively, instead of declaring the right attribute in your CSS, just declare it in your HTML inline if that'll be the result anyways.
Difficult for me to test because I'm away from home, but if you're looking to check what the CSS value is, you could use
getComputedStyle
.Or, alternatively, instead of declaring the
right
attribute in your CSS, just declare it in your HTML inline if that'll be the result anyways.You can then just reference that value with
element.style.right
to do the same addition.Smarter might be to use a keyframes animation that'd be exclusively in CSS. I'd check out this page: developer.mozilla.org/en-US/docs/W...
You can then toggle the
element-slide
class on theimg
element as needed.