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

  • Home
  • SEARCH
  • 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 7838793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:12:49+00:00 2026-06-02T15:12:49+00:00

I have a wordpress website where in post page I have a jquery fixed

  • 0

I have a wordpress website where in post page I have a jquery fixed sidebar. The fixed sidebar starts from the post section and stops at comment section.

I am using this jquery

$window = $(window),
    $sidebar = $("#side-scroller"),
    sidebarTop = $sidebar.position().top,
    sidebarHeight = $sidebar.height(),
    $footer = $("#comments"),
    footerTop = $footer.position().top,    
    $sidebar.addClass('fixed');

    function isScrolledIntoView(elem)
    {
        var docViewTop = $(window).scrollTop();
        var docViewBottom = docViewTop + $(window).height();

        var elemTop = $(elem).offset().top;
        var elemBottom = elemTop + $(elem).height();

        return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
    }


    $window.scroll(function(event) {
        scrollTop = $window.scrollTop(),
        topPosition = Math.max(0, sidebarTop - scrollTop),
        topPosition = Math.min(topPosition, (footerTop - scrollTop) - sidebarHeight);
        $sidebar.css('top', topPosition);

        if(isScrolledIntoView('#comments')){
            $("#side-scroller").hide();
        }
        else{
            $("#side-scroller").show();
        }
    });

This works well, but when the post content is too long then it never stops at the comment section.

Here you can see the demo,

Normal post(where fixed sidebar works properly)
http://webstutorial.com/html5-css3-toggle-slideup-slidedown/html-5

And long post(where sidebar keeps on scrolling)
http://webstutorial.com/google-server-side-geocoding-php-infobox/website-tweaks/google

THIS IS NOT SPAM, OR LINK BUILDING, so please no down votes

  • 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-02T15:12:50+00:00Added an answer on June 2, 2026 at 3:12 pm

    I think it is working, however it is calculating the height incorrectly due to changes of the page after load.

    so if you move this into the $window.scroll function it should get the correct values on scroll.

    $footer = $("#comments"),
    footerTop = $footer.position().top;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wordpress website (buddypress plugin/themes). I'm using a plugin that requires access
I am using Wordpress for this design portfolio website: http://onomadesign.com/wordpress/identity-design/shleppers-moving-storage/ Now, on this single.php
I have a WordPress blog on my website. But I've created my own page
I have been removing our website from wordpress onto its own platform. Temporarily I
I'm running a Wordpress website and I have a <marquee> on the front page
i'm trying to create a portfolio website using wordpress, each post has view costum
I have a WordPress website that needs to have its articles in multiple languages.
I have a (Wordpress powered) website, and Google is indexing some of the sub-directories.
i have a wordpress based website. I have a standard wordpress loop that executes
I migrate from Joomla to WordPress my web site and now I have many

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.