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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:34:50+00:00 2026-06-07T04:34:50+00:00

Is it possible to re initialize a gmap3 map to its default settings (lat,

  • 0

Is it possible to re initialize a gmap3 map to its default settings (lat, long, zoom etc)?

I tried destroy on the map and then re run the initialise but it is not working.

See my jsfiddle here – http://jsfiddle.net/vlowe/z9dDE/1/

  • 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-07T04:34:51+00:00Added an answer on June 7, 2026 at 4:34 am

    Wrap the map element in a container div, and then when you want to reset the map, just remove the whole map div and recreate it. This should solve the problem.

    According to the gmap3 documentation, you still need to call destroy on the map before removing the dom element.

    HTML code

    <div>
        <div id="map"></div>
    </div>
    
    <a href="#" onclick="restore();">restore</a>​
    

    JavaScript

    var dlat = 53.9783997; // default map latitude
    var dlng = -1.5666347; // default map longitude
    var dzoom = 6; // default map zoom
    var dmaptype = "roadmap"; // default map type
    // create gmap
    $('#map').gmap3({
        action: 'init',
        options: {
            center: [dlat, dlng],
            zoom: dzoom,
            mapTypeId: dmaptype,
            mapTypeControl: true,
            mapTypeControlOptions: {
                style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
            },
            navigationControl: true,
            scrollwheel: true,
            streetViewControl: true
        }
    });
    
    
    function restore() {
    
        $('#map').gmap3({
            action: 'destroy'
        });
    
        var container = $('#map').parent();
        $('#map').remove();
        container.append('<div id="map"></div>');
    
        // create new gmap
        $('#map').gmap3({
            action: 'init',
            options: {
                center: [dlat, dlng],
                zoom: dzoom,
                mapTypeId: dmaptype,
                mapTypeControl: true,
                mapTypeControlOptions: {
                    style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
                },
                navigationControl: true,
                scrollwheel: true,
                streetViewControl: true
            }
        });
    
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to initialize a variable in view using razor and then manipulate
is it possible to re-initialize an object of a class using its constructor?
Why is it possible to initialize a Dictionary<T1,T2> like this: var dict = new
Why is not possible to initialize a property to a function when you declare
Possible Duplicate: Initializing private static members Why I can't initialize non-const static member or
Is it possible to do the following (e.g. initialize bool array and set all
Possible Duplicate: Initialize class fields in constructor or at declaration? We are arguing about
Is it possible to initialize a variable from a return parameter (by ref)? Say
Is it possible to initialize all UI elements of certain type (like all TextViews
Is it possible to initialize a reference member to NULL in c++? I'm trying

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.