There are several adjacent objects, suggesting an animation hint to each of them (a list of ul , in which li appear one after another smoothly). Since there are many elements and the user can abruptly follow them, he decided to make a delay in the form of debounce(f, 150ms) . But now if you randomly hover over an object and not interact in principle, the hint of the last affected object appears with anything (it is logical), since debounce triggered later than .stop().fadeOut() worked. And sometimes there is a bug that if you pull a hand from one object to another (did not recreate it here, maybe someone can figure it out, if not, I will try to give an example), then a hint appears under the cursor, but since it overlaps the object , which shows that it immediately disappears and the mouse on the object again, the hint appears and everything goes in cycles.
function debounce(f, ms) { let timer = null; return function (...args) { const onComplete = () => { f.apply(this, args); timer = null; } if (timer) { clearTimeout(timer); } timer = setTimeout(onComplete, ms); }; } function renderHint() { $('#hint').stop().append('123').fadeIn('100'); } let renderHintDebounce = debounce(renderHint, 150); $('.block').on('mouseenter', function(e) { $('#hint').empty(); $(this).mousemove(function(pos) { $("#hint") .css('left', (pos.pageX + 50)+'px') .css('top', (pos.pageY - 30)+'px'); }); renderHintDebounce(); }); $('.block').on('mouseleave', function(e) { $('#hint').stop().fadeOut(100).queue(function() { $(this).empty().dequeue(); }) }); .container { display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw; } .block { width: 100px; height: 100px; background: red; } #hint { position: absolute; display: none; background: #eee; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="container"> <div class="block"></div> </div> <div id="hint">123</div> Added . If the tooltip removed additions by location ie The added 50 and 30 pixels then the error with the appearance and disappearance of the hint is similar to the one that I have.