Suppose there is a block movement through .animate()
let end = $('.way').width() - $('.block').width(); $('.block').animate({ 'left': end }, 2000, 'linear');
.way { display: block; width: 100%; height: 50px; padding: 5px; border-radius: 5px; background: #ddd; box-sizing: border-box; } .block { display: block; width: 40px; height: 40px; border-radius: 4px; background: red; position: relative; }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="way"> <div class="block"></div> </div>
How to make it so that when end == end - ($('.block').width() * 3)
animation changes, and abruptly and without “interrupting” the animation itself.
Let the block become background: green; border-radius: 100%
background: green; border-radius: 100%
.
progress
? - teranstep
, mb will be more convenient in this case - teranprogress
did not hear, and did not work withstep
. Thank you, read about them and try - CbIPoK2513