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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:56:38+00:00 2026-05-28T01:56:38+00:00

I have a google Maps with height and width 100% in the css. I

  • 0

I have a google Maps with height and width 100% in the css.

I use the following to resize the map when the windows is resized:
also with the more options button a sidebar gets activated then also the div of the map (#kaart) resizes.

Within the sidebar I have a accordion. when this accordion is toggled and and its height exceeds the windows height then there is again a resizement. But then on the bottom there is some not used space. and when you close som of the accordions the width changes again because of the scrollbar leaving that scrollbar width as not used space.

//Variabels
var viewportWidth = $(window).width();
var viewportHeight = $(window).height();
var buttonState = false;

$(window).resize(function() {
    // resize map when window is resized
    viewportWidth = $(window).width();
    viewportHeight = $("#sidebar").height();
    setMapDimensions();
});

//set map width according to viewport
function setMapDimensions() {
    viewportWidth = $(window).width();
    if(buttonState == true) {
        viewportHeight = $("#sidebar").height();
        $("#kaart").width(viewportWidth - 221);
        $("#kaart").height(viewportHeight);
    } else {
        viewportHeight = $(window).height();
        $("#kaart").width(viewportWidth);
        $("#kaart").height(viewportHeight);
    }
}

Any idea why this is?

Here is the jsfiddle demo:

http://jsfiddle.net/tDYcX/13/

  • 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-28T01:56:38+00:00Added an answer on May 28, 2026 at 1:56 am

    I would solve it by just adding:

    overflow-x: hidden;
    overflow-y: visible;
    

    to #sidebar.
    The map will not resize and jump around then. Also gives a better user experience in my opinion. A lot like Google’s recent changes to their Gmail interface. Like theirs you should also consider using a custom scrollbar 🙂

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

Sidebar

Related Questions

I have a page with a Google Maps div: <div id=map_canvas style=width: 100%; height:
I am using http://code.google.com/p/jquery-ui-map/ HTML: <div id=map_canvas style=width: 100%; height:400px; latitude=123456 longitude=123456>Loading Map</div> jQuery
I have a dynamic map in Google Maps (API v2) I want to overlay
I have the following code to open google maps: NSString *urlString = [NSString stringWithFormat:@http://maps.google.com/maps?q=%@,
I have a full screen Google map with HTML/CSS toolbars overlaid on the map,
I currently have Google Maps integrated into my webpage. It is being used to
Is there a way I can have a google maps control on a web
I have a page with a Google Maps mashup that has pushpins that are
I have some C# code that generates google maps. This codes looks at all
I have an application that uses the Google Maps API to geocode distances between

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.