Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3878846
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:39:31+00:00 2026-05-19T22:39:31+00:00

Has anyone tried using $(html, body).animate({scrollTop:0}, ‘slow’); on Opera browser? It does a weird

  • 0

Has anyone tried using

$(“html, body”).animate({scrollTop:0}, 'slow');

on Opera browser?

It does a weird effect especially if you scroll on a long page, it seems like the page go first to the top and then it scroll down to the right point. It is a weird disturbing effect…

Is there any workaround to fix it? thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:39:32+00:00Added an answer on May 19, 2026 at 10:39 pm

    The attribute was not defined properly in the past. It was introduced by IE, I think, then reverse engineered to be implemented by different user agents. It has been since described in CSSOM (still a working draft). As of today, there is still a bug indeed in Opera which is being in the process to be fixed.

    ## Possible hack.

    A solution will be

    $(window.opera?'html':'html, body').animate({ 
      scrollTop:0}, 'slow' 
    );
    

    Be careful because if Opera fixes it at a point, the code is likely to behave strangely.

    Why?

    • In Firefox and IE quirks mode, you have to set the property on the “body” to make the page scroll, while it is ignored if you set it on the “html”.
    • In Firefox and IE standards mode, you have to set the property on the “html” to make the page scroll, while it is ignored if you set it on the “body”.
    • In Safari and Chrome, in either mode, you have to set the property on the “body” to make the page scroll, while it is ignored if you set it on the “html”.

    Since the page is in standards mode, they have to set it on both the “html” and “body, or it won’t work in Safari/Chrome.

    Now here’s the bad news; in Opera, when you read the scrollTop of the body it is correctly 0, since the body is not scrollable within the document. But Opera will scroll the viewport if you set the scrolling offset on either the “html” or “body”. As a result, the animation sets two properties, once for the “html” and once for the “body”. The first starts at the right place, while the second starts at 0, causing the flicker and odd scroll position.

    Better solution not involving user agent sniffing

    From http://w3fools.com/js/script.js

        // find out what the hell to scroll ( html or body )
        // its like we can already tell - spooky
        if ( $docEl.scrollTop() ) {
            $scrollable = $docEl;
        } else {
            var bodyST = $body.scrollTop();
            // if scrolling the body doesn't do anything
            if ( $body.scrollTop( bodyST + 1 ).scrollTop() == bodyST) {
                $scrollable = $docEl;
            } else {
                // we actually scrolled, so, er, undo it
                $body.scrollTop( bodyST - 1 );
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone who has tried to implement RoutedCommands in WPF using M-V-VM has undoubtedly run
Has anyone tried installing SQL Server 2008 Developer on a machine that already has
Has anyone tried the ActiveRecord Intro Sample with C# 3.5? I somehow have the
Has anyone tried to dynamically select which properties they want to write to an
Has anyone ever tried, or had any success at getting Wascana (Eclipse CDT +
Has anyone already tried this, anything particulair that I need to be aware of?
has anyone ever tried to get the list of all the movieclips (even the
Has anyone seen anything in Tix work under python 3.0? I've tried to work
Has anyone got EclipseLink MOXy (I'm using eclipselink 2.1.0) to work with Java 5?
Has anyone ever set up Cruise Control to build an OS X Cocoa/Objective-C project?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.