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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:20:45+00:00 2026-06-15T19:20:45+00:00

im trying to implement a scroll to top animation on my site http://www.cmclove.org/bootstrap but

  • 0

im trying to implement a scroll to top animation on my site
http://www.cmclove.org/bootstrap

but whenever i scroll to top and try to scroll back down it seems like the page is fighting me and doesent want to go back down.

you might have to do it a couple of times and or try to scroll immediately back down after the animation finishes

heres the jquery :

$(document).ready(function() {
    $(function() {

        /* set variables locally for increased performance */

        var scroll_timer;
        var displayed = false;
        var $message = $('#message a');
        var $window = $(window);
        var top = $(document.body).children(0).position().top;

        /* react to scroll event on window */
        $window.scroll(function(e) {

            window.clearTimeout(scroll_timer);
            e.preventDefault();
            scroll_timer = window.setTimeout(function(e) {
                if ($window.scrollTop() <= top) {
                    displayed = false;
                    $message.fadeOut(800);
                    e.preventDefault();

                }
                else if (displayed == false) {
                    displayed = true;
                    $message.stop(true, true).show(1000).click(function(e) {
                        $('html, body').animate({
                            scrollTop: 0
                        }, 'slow');
                        $message.fadeOut(1000);
                        e.preventDefault();


                    });
                }

            }, 100);
        });
    });
});​

heres the html

  <a id="top"></a>

  <!--- all my html stuff -->

  <div id="message"><a href="#top"></a></div>
  </footer>
  • 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-15T19:20:46+00:00Added an answer on June 15, 2026 at 7:20 pm

    I know what is happening. You are binding a new ‘click’ event every time ‘scroll to top’ happens. And since they add up, every time the scroll bar freezes for 1 second more. So the first time you scroll to top, nothing freezes. Next time it freezes for a second, next time for 2 seconds and etc.

    I think you need:

    $message.unbind('click');
    

    right before:

    $message.stop(true, true).show(1000).click(function(e) {
    

    i.e.:

    else if (displayed == false) {
      displayed = true;
      $message.unbind('click');
      $message.stop(true, true).show(1000).click(function(e) {
      ...
    

    If you don’t believe me, make it freeze by doing a couple of times ‘go to top’, then write this in the Firebug console:

    $('#message a').unbind('click');
    

    and try it again. You will see that the freezing is gone (until you accumulate it again with multiple bindings of ‘click’ event).

    Cheers.

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

Sidebar

Related Questions

Trying to implement the excellent jQuery bidirectional infite scroll as explained here: http://www.bennadel.com/blog/1803-Creating-A-Bidirectional-Infinite-Scroll-Page-With-jQuery-And-ColdFusion.htm For
I'm trying to implement Dynamic Scrollbox found in http://demo.webdeveloperplus.com/dynamic-scrollbox/ but it has a problem
I am trying to implement an action to scroll to the top of a
I'm trying to implement the following guide to my custom wordpress theme http://tomsbigbox.com/wordpress-load-more-posts-on-page-scroll/ Unfortunately
I've been trying to implement a 3 column fluid layout by following http://www.alistapart.com/articles/holygrail/ (left
I am currently trying to implement this into my current code: http://cubiq.org/iscroll I have
I am trying to implement some code on my web page to auto-scroll after
What I'm trying to do is to implement something like the fruit machine scroll
The slider/carousel I'm trying to implent is this: http://www.paulwelsh.info/jquery-plugins/hero-carousel/ This is my HTML, CSS
I m pretty new to iPhone development. I'm trying to implement scroll view with

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.