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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:44:02+00:00 2026-06-18T01:44:02+00:00

Am building a webapp which has a sidebar, and i want sidebar to always

  • 0

Am building a webapp which has a sidebar, and i want sidebar to always be fitted in the viewport like this
image1

and also fit to the viewport when the app in full screen mode.
How can i achieve this with jquery.
I have tried subtracting the height of the header from that of the document

$(document).ready(function() {
        var bodyheight = $('body').height();
        $(".app-sidebar").height(bodyheight);
    });

    // for the window resize
    $(window).resize(function() {
        var bodyheight = $(document).height();
        var header = $('.app-north').innerHeight();
        $(".app-sidebar").height(bodyheight - header);
    });
  • 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-18T01:44:03+00:00Added an answer on June 18, 2026 at 1:44 am

    Why not use css position:fixed and give the sidebar a min-height: 100%. Using jQuery or javascript to size the div on window resize will be very choppy. Anyways, to get the height of the viewport, you should use $(window).height as opposed to document. Here is a function that should work:

    var prev,
      const_header_height = $('.app-north').innerHeight(),
      $app_sidebar = $('.app-sidebar'); // get the element first to avoid hitting the DOM each call of resize()
    
    function resize () {
      var curr = $(window).height()
      // only resize if new height is different
      if (curr != prev) {
        $app_sidebar.height(curr - const_header_height);
        prev = curr;
      }
    }
    
    $(window).on("resize", resize)
    $(document).ready(resize)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a web app that has a class called Product, which I'd
I want to assemble a web module which looks like the following: src/main/java (has
I am building a simple C# web app which will act like an online
I am building a webapp with Django which generates invoices. Each invoice has a
I'm am building a web app and need a text to speech which highlights
i am building webapp similar to facebook. I want to query the database so
Hi i'm building a webapp. To remove the onclick delay i found this script
I am building a demo dataset for my webapp. I would like thousands of
I'm writing a web app which is used a SaS. Each customer has their
We are building a webapp which is shipped to several client as a debian

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.