There is a script in which the animate () function is used; it just simply changes the left property of several elements, but when you open a dozen tabs or load the browser with chrome in other ways, this function starts to lag and the values are set incorrectly, as a result of which the blocks run over each other, like to solve it?
/* global $ */ setInterval(function () { var length = $('#mytag .item').length; var left = parseInt($('#mytag').css('left')); if (length > 4 && left == 0) { $('#mytag').animate({ left: 0 - parseInt($('#mytag .item').outerWidth()) }, { duration: 1000, complete: function () { $('#mytag .item').eq(0).remove(); $('#mytag').css('left', 0); } }); } }, 2000); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>