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 9118141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:04:24+00:00 2026-06-17T05:04:24+00:00

I want to execute the following script $(‘html, body’).animate({ scrollTop: $(‘#deckblatt’).offset().top }, 1) deckblatt

  • 0

I want to execute the following script

$('html, body').animate({
    scrollTop: $('#deckblatt').offset().top
}, 1)

deckblatt is the first content-div on my page.

Chrome won’t do this, but FF would.

The confusing part is that i’ve got the same excent method running on a second page, which works perfectly fine on both Chrome and FF.

What have i missed or is there maybe a better way to do what i want to achieve, preventing the browser from automatically jumping to a section of the page when it was scrolled down before?

Thank you in advance.

EDIT:

Here is the complete code for the first project, which is not running correctly

sprottenwels

And here is the code of the second one, which works fine

#2

  • 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-06-17T05:04:25+00:00Added an answer on June 17, 2026 at 5:04 am

    It’s not a Chrome bug. Your original code contains some strange stuffs.

    • You don’t have any elements with scroll-top class, which should be shown when scrolling down, and which the user could click on to scroll to the top.
    • You don’t have any elements with top or bottom id like in the other one.
    • You left out some needed CSS codes from the JSFiddle-code which you do have in the other working example.
    • But one of the most important errors: target variable is undefined in your JavaScript code, and you inspect its equality with “#top” string. This leads to a ReferenceError exception. I think you wanted to inspect whether the click event’s target element’s id is equal to the "#top" string. For this, you should declare e.g. the event argument in the event handler, and use event.target.id.
      So instead of this:

      $('.scroll').click(function(){
      
          $('html, body').animate({
              scrollTop: $(this.id).offset().top
          }, 500);
      
          setTimeout("$('.scroll-top').fadeIn();",510 );
      
          if (target == "#top"){$('.scroll-top').hide() ;}
      
      });
      

      You should use this code:

      $('.scroll').click(function(event) { // declaring event variable as an argument
          $('html, body').animate({
              scrollTop: $(this.id).offset().top
          }, 500);
      
          // inspecting the id of the click event's target element
          if (event.target.id == "#top") {
            $('.scroll-top').hide();
          } 
          else {
            setTimeout(function () {
              $('.scroll-top').fadeIn();
            }, 510);
          }
      
      });
      

    I modified your original code, uncommenting very much unneeded stuffs, but there are still many left:

    http://jsfiddle.net/uKcQG/3/

    It’s still a little buggy, but now the scrolling seems to work correctly.

    But as I suggested in my comment, you should definitely use Ariel Flesler’s jQuery scrollTo plugin for this task: http://demos.flesler.com/jquery/scrollTo/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build a shell script to execute the following two commands, but
i want to execute shell commands from my groovy script. I tested the following:
I have the following script that I want the production guys to execute using
I want to execute following command in shell script cp /somedire/*.(txt|xml|xsd) /destination/dir/ But this
When you execute following example using Firefox 3: <html> <head> <script language=javascript type=text/javascript> <!--
I want to execute python code from C# with following code. static void Main(string[]
I want the following code to execute when the myString is having either of
I have asp.net generated html code. I want execute jQuery click function when user
I have the following MySQL script which I want to implement in PostgreSQL. SET
I have a perl script and I want to do the following: system(source myscript.sh);

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.