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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:27:57+00:00 2026-06-15T00:27:57+00:00

I had implemented the CSS-Tricks Smooth Scrolling snippet on my homepage and it was

  • 0

I had implemented the CSS-Tricks Smooth Scrolling snippet on my homepage and it was working wonderfully UNTIL I decided to rebuild my homepage. Now it’s not working at all.

Here’s a bit of history on what I did. I’m trying to build a single-page scrolling website. Originally, I created a page in WordPress and inserted 3 divs called ‘about,’ ‘work,’ and ‘contact.’ I implemented the Smooth Scrolling snippet, and everything was working nicely. However, then I decided to do some more research during which discovered the magic of WordPress custom post types. I decided to rebuild my homepage with a custom template (page-include.php) that uses WP_query to include 3 different pages. Two of the pages (‘about’ and ‘contact’) are actual WordPress pages, but the third (‘work’) is just a custom loop pulling my custom post type. Long story short, when I went to Settings > Reading and changed the homepage to direct to the new page, the smooth scrolling stopped working. When you click on the links in the nav bar, the page jumps to the appropriate spot, but it doesn’t scroll at all. If I change set the homepage back to the old version, the scrolling still works fine. Any ideas on why it stopped working?

If it helps, here’s my site. Also, if you’re wondering, my theme is based on Roots.

  • 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-15T00:27:58+00:00Added an answer on June 15, 2026 at 12:27 am

    There’s an error occuring on JavaScript execution, that’s why the script quits, and therefore no smooth-scrolling gets applied.

    I’ve seen, that your script in plugins.js walks all the links with a hash (#) at the start of href. Unfortunately you have a link in your nav bar, that is like this: <a href="#anchor3">Anchor 3</a>

    Now you don’t have a section like <div id="#anchor3"> in your website, that’s the reason your script throws an error.

    The problem is this line of code in your plugins.js, circa line 30:

    var targetOffset = $target.offset().top;
    

    $target is empty, try alert($target.length) or console.log($target.length) to get the proof. Now to fix this, change this line:

    if (target) {
    

    to this:

    if (target && $target.length) {
    

    Now before calling .offset() your script will check if there are any elements in your jQuery selection. If $target is empty, it won’t fire, scripts will continue to work.

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

Sidebar

Related Questions

I had started working on GPGPU some days ago and successfully implemented cholesky factorization
I have implemented antiforgery token on my login page. Now I had one user
I was looking at how some site implemented rounded corners, and the CSS had
I had implemented copy to clipboard functionality. It is working fine with all version
I had implemented a custom Gallery with custom Adapter. My Requirement is that however
I have implemented mail composer. But it opens mail composer whenever user had implemented
I have a form with 3 text fields and 3 checkboxes. I had implemented
Since short time ago, Google + has had hangouts implemented on the iPhone. You
Need some help with this problem in implementing with XSLT, I had already implemented
I had this jquery idle timeout script implemented into a site, thanks to ehynds

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.