0

In a Web Page, I'm trying to get the coords of an adress given by the user.

I'm trying to do something like: http://www.bufa.es/google-maps-latitud-longitud/

But I have a problem. The map is placed inside a div with this structure:

<div id="divgeolocalizacion" style="display:none;">
...
<div style="width:100%; clear:both;">
    ...
    <div style="float:left; width:57%; margin-right:3%;">
        <div id="map">
            ...
        <div>
    <div>
<div> 
<div>

The user has a button on the page, which executes some javascript code. This code only changes the div display style to "block". The problem is that the map is very very small. However, when I open developers's tools with F12, the image changes its size.

Why i'm getting this strange behaviour? Before you ask, I didn't have any "console.log()" on my javascript code.

Pd: When div's display style is initially set to "block" all works perfectly.

4

2 回答 2

1

我在这里找到了 vaelico 的解决方案:Google Maps Display:None Problem

为了解决这个问题需要在更改div的显示样式后在javascript中添加这一行:

google.maps.event.trigger(map, "resize");
于 2013-10-24T06:31:36.643 回答
0

none并且blockdisplay属性的值,所以你应该有

display: none;

或者

display: block;

在标签的style属性中,而不仅仅是值。

于 2013-10-23T14:07:04.323 回答