Place Ghantoos

Specify your Google Maps Javascript API version!

Tagged:

I woke up this morning to find out that the Google maps widget that I used on my ads website http://sooksook.com was pop-ing out regardless of the block visibility set on the div.

How it is supposed to work: the block is hidden until the user clicks on a specific area that triggers an onClick() and pops-out the map.

 

The source of this div looks like the following:

<div class="input-group-btn">
    <button type="button" class="btn btn-default dropdown-toggle"><i class="icon-map-marker"></i></button>
    <ul class="dropdown-menu pull-right" style="display:block;visibility:hidden;z-index:999;">
        <li>
            <div id="location_ed_location_map" class="ed_location_map" style="width:560px;height:270px;"></div>
        </li>
    </ul>
</div>

After some time try to understand why the map ignored the “visibility:hidden” parameter, it turned out that by default, when referring to the Google Maps Javascript API, it points to the nightly build of the API: which could change ANYTIME!

I’m still not sure what changed in the API that made the map widget behave in this unusual way. Anyways, you better make sure to specify you Google Maps Javascript API version, using the “v=” parameter:

<script src="http://maps.googleapis.com/maps/api/js?v=3.18&amp;sensor=false"></script>

Hope this helps.

— Ignace M

Sources:

Tagged:

Leave a Reply