I have three separate files for my program/application: html, CSS and JavaScript. I need to make an object move to a certain place using CSS animation (JavaScript is not allowed). However, the destination of the object changes, which is why I used JavaScript to get the current coordinates:
var x = $('#correct > span:empty').offset();
Now, I can use the acquired coordinates in JavaScript, using x.left and x.top. However, because I'm only allowed to use CSS animation, I would need to use the coordinates in my CSS file. This is why I need Your help.
Is it possible to do that? If so, how? This is what I have written in my CSS file for the object (span):
p > span {
background-color: white;
box-shadow: inset 0 0 10px #999;
height: 2.5em;
width: 2.5em;
display: inline-block;
margin: 5px;
border-radius: 10px;
text-align: center;
line-height: 2.5em;
vertical-align: middle;
}
Now, the object span has to move animatedly to '#correct > span:empty' (and I've already gotten the coordinates of that one with JS).
I have thought of using transition, but I still don't know if or how I can use the coordinates.
Can You please help me?