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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:07:01+00:00 2026-06-17T19:07:01+00:00

On this page > http://canvas.clickbump.com/example/ I’ve got a floating Table of Contents box which

  • 0

On this page > http://canvas.clickbump.com/example/

I’ve got a floating “Table of Contents” box which has hyperlinks that target a couple of hidden anchor elements on the page:

<a id="anchor1">This is anchor 1</a>

And

<a id="anchor2">This is anchor 2</a>

The markup of the box:

<details class="cb-toc" open="open">
    <summary>Table of Contents</summary>
    <ol>
        <li><a href="#top">GoTo Top</a></li>
        <li><a href="#anchor1">GoTo Anchor 1</a></li>
        <li><a href="#anchor2">GoTo Anchor 2</a></li>
    </ol>
</details>

I’m trying to use the jQuery script below in order to bind the clicks on the TOC’s links so that it moves the floating box to the position adjacent to the target anchor. However, its hit or miss. Takes two clicks on the anchor to move the box to the proper position.

Here’s the jQuery I’m using:

jQuery('.cb-toc a').on('click',foo);
function foo(){
    jQuery('a:target').after(jQuery('.cb-toc'));
}

Any ideas what can do to get it to move the box to the proper position on the first click every time?

  • 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-17T19:07:03+00:00Added an answer on June 17, 2026 at 7:07 pm

    Manually select the correct anchor:

    jQuery('.cb-toc a').click(function(e){
        var str = jQuery(this).attr('href');
        jQuery(str).after(jQuery('.cb-toc'));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so for this page: http://www.facebook.com/ESPN?sk=app_224097940938597 Which appears on the left hand bar between
if u check this steam page http://store.steampowered.com/ There is a banner which feature games,
Note: I'm using Google Chrome Currently I have this test page http://www.evecakes.com/doodles/canvas_size_issue.htm It should
in this page http://api.jquery.com/category/effects/ when you put 'up'(keyboard) and 'down',then put 'enter',it will go
On this page: http://www.palosverdes.com/sandbox/9slategrey/index.cfm I'm trying to put in a new menu (the one
On this page: http://www.anasiamusic.com/bio.html in the body text (Ana Sia's DJ crate is a
ANY DOM element can be made resizable according to this page: http://jqueryui.com/demos/resizable/ However, it
Hi I am following this tutorial found on this page: http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/ Here is the
The output page: http://tinyurl.com/9stfo3p The Code: http://tinyurl.com/8wz9krj Direct Question: Am I approaching this the
http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html If I move the slider on this page, the blurring is very smooth.

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.