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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:45:23+00:00 2026-05-25T02:45:23+00:00

I have a sticky side menu that I would like to have be able

  • 0

I have a sticky side menu that I would like to have be able to link to the next or previous post on the wordpress main index page, based on where you are in the line of posts. The functionality would be similar to the up and down arrows on the left side of this site (clearly not mine): http://www.dbworks.pro/

I already have the Scrollto functionality working on the page so that I can link to an embedded anchor at the top and bottom and it’ll scroll to it. I also have already set up each post so that it pulls the post number and sets the containing div’s id accordingly.

Is there some way that I can get the previous / next links to recognize which post I’m at on the page and calculate which would be the appropriate div to scroll to? Thanks for your help.

— Edit ————————————————–

So I’m attempting to adapt this script for my purposes and I can get everything to work apart from the movement functionality. The elements hide and show at the correct times and the links work if a different javascript action is put in place in the onclick field of the anchor. The only thing that I can’t get to work is the previous and next project scroll functionality. Here is the Javascript I’ve been working with:

<script type="text/javascript">
function goToProject(project_number) {
current = project_number;
var top = 0;
if (current == 0) {
  top = 0;
}
else {
  top = $(project_list[project_number]).offset().top - 86;
}
$.scrollTo(top, 500, 'linear');
}

function calcCoordinates() {    
project_list.each(function(i) {
  project_coordinates[i] = $(this).offset().top;
});
}

function calcCurrent() {
for (n=0; n<project_coordinates.length; n++) {
  if ($(window).scrollTop() >= (project_coordinates[n] - 90)) {
    current = n;
  }
  else {
    break;
    }
  }
}

$(document).ready(function() {

project_list = $('.post-container');
project_coordinates = Array();
current = 0;

calcCoordinates();

$('#top-link').hide();
$('#previous-link').hide();
$('#next-link').hide();
$('#bottom-link').hide();
});


$(window).scroll(function() {
calcCurrent();

if ($(window).scrollTop() > 1000) {
  $("#menu").css({ "display": "block" });
  $('#top-link').fadeIn('100');
  $('#previous-link').fadeIn('100');
  $('#next-link').fadeIn('100');
  $('#bottom-link').fadeIn('100');
}
else {
  $('#top-link').fadeOut('100');
  $('#previous-link').fadeOut('100');
  $('#next-link').fadeOut('100');
  $('#bottom-link').fadeOut('100');
}

});

$(window).resize(function() {
calcCoordinates();
calcCurrent();
});
</script>

And here is my corresponding HTML:

<ul id="menu">
<li><a id="top-link" href="#firstpost"><h4>Top</h4></a></li>

<li><a id="previous-link" onclick="if (current > 0) { goToProject(current-1); } return false;"><h4>Previous</h4></a></li>

<li><a id="next-link" onclick="if (current < project_list.length - 1) { goToProject(current+1); } return false;"><h4>Next</h4></a></li>

<li><a id="bottom-link" href="#sidebar"><h4>Bottom</h4></a></li>

</ul>  

Each post is also labeled with class=”post-container”. Any thoughts as to why this wouldn’t be working? Again, I’ve adapted this for my purposes from another site . . . so there may be some legacy values that I don’t know I’d need to change.

  • 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-25T02:45:23+00:00Added an answer on May 25, 2026 at 2:45 am

    Figured it out. It wasn’t understanding the scrollTo() function so I just had to define it 🙂
    http://flesler.blogspot.com/2007/10/jqueryscrollto.html

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

Sidebar

Related Questions

Ok, here is the problem: I have a left side menu that will not
I have a file in cvs that has Sticky Options set to -kk .
I have a GWT dialog box that looks like the following: public class FooDialog
I'm creating a web site that I think must have a client side database.
I have a 'sticky sidebar nav' that is positioned absolutely relative to the #sidebar
I would like to make a big display by putting monitors side by side.
I have recently run into a particularly sticky issue regarding committing the result of
I'm working on this website, and have a little thorn in my side. When
Environment: VS2010, SL4, RIA Services I have an SL4 UI that I developed against
The reason I ask is that I am trying to run MVC side-by-side 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.