Coding⏱️ 1 min read📅 2026-05-31

How to Fix: Animate scrollTop not working in firefox

The issue is caused by the browser's default scrolling behavior. To fix it, use the stop() method to pause the animation before starting it.

Quick Answer: Use $('body,html').stop(true,true) instead of just $('body').animate({scrollTop: stop}, delay); to prevent double triggering and ensure smooth scrolling.

To fix the issue of animate not working in Firefox, you need to stop the animation before it starts. This can be achieved by calling $('body,html').stop(true,true) before animate. Here's how you can modify your code:

💡 Modified Code

$('body,html').stop(true,true).animate({scrollTop: stop}, delay);

By doing this, you ensure that the animation is stopped before it starts in Firefox, preventing the double trigger issue.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions