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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:33:00+00:00 2026-06-09T20:33:00+00:00

Using Maps API v3. As per Google documentation, if the map container is resized

  • 0

Using Maps API v3. As per Google documentation, if the map container is resized programmatically, the map resize event must be triggered manually.

Resize event: Developers should trigger this event on the map when the div changes size.

Therefore I am using:

google.maps.event.trigger(map, 'resize');

Which listener should I be using to update my markers based on the new bounds of the resized map container?

google.maps.event.addListener(map, 'resize', function() {

    console.log(map.getBounds());
});

The above still shows the bounds before resizing.

  • 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-09T20:33:01+00:00Added an answer on June 9, 2026 at 8:33 pm

    Whenever the map is resized, the bounds will chage. Therefore, you can use the bounds_changed event:

    google.maps.event.addListener(map, 'bounds_changed', function() {
        var bounds = map.getBounds();
    });
    

    It has the following description:

    This event is fired when the viewport bounds have changed.


    If you only want the event to be called after the map is resized, you can use a boolean variable to track whether the map has just been resized, like so:

    var mapResized = false;
    

    Then, whenever you trigger the resize function, you can set the mapResized variable to true. You can do so using a function:

    function resizeMap(map) {
        google.maps.event.trigger(map, 'resize');
        mapResized = true;
    }
    

    Then, in the bounds_changed event, you can only react to call if mapResized is true, and afterwards set mapResized to false:

    google.maps.event.addListener(map, 'bounds_changed', function() {
        if (mapResized) {
            // react here
        }
        mapResized = false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Google Maps' API and added a few markers in a map. Each
Update II I Figured this out. When using google maps api, the model must
I have the following problem. I have embedded a map using Google Maps' API.
In Google Maps API v2, I was using map.clearOverlays() to remove the marker and
I am using Google Maps API to display a map on a certain page.
I'm using Google Maps API V3 and my page loads a map with 5
I'm using Google maps api v3. In the middle of the map there is
I am using google maps api to place markers on a map. The gps
I'm using google maps api to have a map show up on my website
I am using Google Maps API (v3) to render a world map. When I

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.