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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:36:29+00:00 2026-06-12T12:36:29+00:00

My anchor links should be animated, so that they do not jump immediate to

  • 0

My anchor links should be animated, so that they do not jump immediate to the link but rather scroll in a smooth fashion.
This should work in both directions, i.e. when clicking on the link containing the footnote and the reversefootnote class.

Structure

HTML

<p>
  Some text.
  <a href="#fn:1" id="fnref:1" title="see footnote" class="footnote">[1]</a>
</p>

<div class="footnotes">
  <ol>
    <li id="fn:1">
      <p>
        A footnote.
        <a href="#fnref:1" title="return to article" class="reversefootnote">&nbsp;?</a>
      </p>
    </li>
  </ol>
</div>

jQuery

$("a[href*='#fn\\:']").click(function(event) {
    event.preventDefault();
    var href = $(this).attr("href");
    var $el = $(href);

    $("html, body").animate({"scrollTop": $el.offset().top}, 500);
});

Problem

The problem that it does not work occurs only when I use a colon in href, therefore I would be more than happy if someone can show me a way how to escape these, or even show me a better approach.

  • 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-12T12:36:30+00:00Added an answer on June 12, 2026 at 12:36 pm

    you don’t need to escape the colon in that pattern match….

    but the colon should be escaped in the selector:

    var $el = $(href.replace(':', '\\:'));
    

    and the first selector should be altered:

    $("a[href*='#fn\\:']").click(function(event) {...});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Google's smooth scrolling script for a specific anchor link #tothetop and not
Anchor links that point to ID of a hidden element will cause browser to
hello guys I am trying to extract all the anchor links from aol but
I am trying to render a simple hyperlink that links to a named anchor
Basically, I want to have links throughout the page that change the anchor --
I'm trying to have just one link on my website that links to the
I am trying to create a menu using anchor tags, and they should butt
Here...The code i have added to filter the anchor link is not working.. And
I know that most links should be left up to the end-user to decide
Firstly, this seems like something that should have been asked before, but I cannot

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.