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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:59:06+00:00 2026-05-23T07:59:06+00:00

I am using this bit of code to open a div and scroll down

  • 0

I am using this bit of code to open a div and scroll down to it. It works well, but only the first time I use it, even on page refresh it will not work again. Does anyone know why this is happening? Thanks in advance!

Here is the URL(http://www.patrickorr.ca)

$(document).ready(function() {
$("div.ftropen")
    .click(function(){
        $("div#connect").animate({height: "500px" }, "fast");                                              
        $("div#ftrconnect").fadeOut("fast");  //hide connectbtn
        $("div#ftrhide").fadeIn("fast");  //show hidebtn
        $("#connect").scrollTop($("#connect").scrollTop() + 500);
    return false;
});
$("div.ftrclose")
    .click(function(){
        $("div#connect").animate({height: "0px" }, "fast");                                            
        $("div#ftrhide").fadeOut("fast");  //hide hidebtn
        $("div#ftrconnect").fadeIn("fast");  //show connectbtn
    return false;
});
});
  • 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-23T07:59:07+00:00Added an answer on May 23, 2026 at 7:59 am

    There seems to be a problem with the jquery.anchor.js library that is giving me Uncaught TypeError: Cannot read property 'top' of null jquery.anchor.js:32 in Chrome 14. I have commented it out and replaced the open function with:

    $("div.ftropen").click(function(){
        $("div#connect").animate({height: "500px" }, "fast", function() {
            $("body").scrollTop( $("#connect").position().top);
        });                                    
        $("div#ftrconnect").fadeOut("fast");  //hide connectbtn
        $("div#ftrhide").fadeIn("fast");  //show hidebtn
        return false;
    });
    

    that scrolls the body to the top of the <div id="connect">

    I’ll see if I can get the anchor animate plugin working…

    Actually the Anchor Slider plugin seems to be interfering with your <div> click events completely. The <a> click is occurring first and consuming the event. I think that you need to decide to use the Anchor Slider plugin to animate the “scroll to” or the jQuery animate() in your code.

    Edit: If you remove the jquery.anchor.js script, use the following target

    <div id="connect" style="height:0px; display:block;"><a style="display:block;margin-top:500px;height:100px;" id="target" name="target">f</a></div>
    

    and this JavaScript:

    $(document).ready(function() {
        $('div.ftropen').click(function(event){
            $('div#connect').animate({height: '500px' }, 'fast', function() {
                $('body').animate({scrollTop : $('#target').position().top + 500}, 700);
            });
            $('div#ftrconnect').fadeOut('fast');  //hide connectbtn
            $('div#ftrhide').fadeIn('fast');  //show hidebtn
            event.stopPropagation();
            return false;
        });
        $('div.ftrclose')
            .click(function(){
                $('div#connect').animate({height: '0px' }, 'fast');
                $('div#ftrhide').fadeOut('fast');  //hide hidebtn
                $('div#ftrconnect').fadeIn('fast');  //show connectbtn
            return false;
        });
    });
    

    which animates the scroll to the <a id="target"> when the <div> height animate has completed.

    Edit2: Added a demo.

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

Sidebar

Related Questions

i have this bit of nasty code :P that updates a div using AJAX,
Using this code to zip a folder and it works perfect on small files
So - I've been using this method of file uploading for a bit, but
I am using this bit of jQuery code to get href of the link:
Using c#, VS2005, and .NET 2.0. (XP 32 bit) This is a Winforms app
Using this: Can I use Facebook's fb:friend-selector in an iframe? I created a multi-friend
Using this jquery code: <a href=javascript:void(0) id=m1>Get Selected id's</a> jQuery(#m1).click( function() { var s;
Im using this code for mysql connection $con = mysql_connect(localhost:/var/lib/mysql/mysql.sock, abc , xyz); if
This bit of code runs on Windows Compact Framework and what it does is
I'm using this code to convert a jpg image into a png 8. The

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.