We would like to know how to add offset to css animation restart.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.10.1.js'></script>
<style type='text/css'>
#a {<!-- www . j av a2s .c o m-->
width: 100px;
height: 100px;
position: absolute;
background-color: green;
transition: top 2s linear;
top: 0px;
}
#b {
position: absolute;
left: 200px;
}
</style>
<script type='text/javascript'>
$(window).load(function(){
$(document).ready(function(){
$("#b").mousedown(function(){
$("#a").css({"top":"200px"});
});
$("#b").mouseup(function(){
$("#a").css({"top":"0px"});
});
});
});
</script>
</head>
<body>
<div id="a">A</div>
<button id="b">Move</button>
</body>
</html>
The code above is rendered as follows: