css - 应用 css3 缩放属性后,谷歌地图图钉点击不起作用

标签 css google-maps css-transitions

Google map 图钉点击在应用 css3 缩放属性后不起作用。我无法点击它。

我想应用缩放属性。

        <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
            <script>
    // This example displays a marker at the center of Australia.
    // When the user clicks the marker, an info window opens.

    function initialize() {
        var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
        var mapOptions = {
            zoom: 4,
            center: myLatlng
        };

        var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

        var contentString = '<div id="content">'+
                '<div id="siteNotice">'+
                '</div>'+
                '<h1 id="firstHeading" class="firstHeading">Uluru</h1>'+
                '<div id="bodyContent">'+
                '<p><b>Uluru</b>,</p>'+
                '</div>'+
                '</div>';

        var infowindow = new google.maps.InfoWindow({
                content: contentString
        });

        var marker = new google.maps.Marker({
                position: myLatlng,
                map: map,
                title: 'Uluru (Ayers Rock)'
        });
        google.maps.event.addListener(marker, 'click', function() {
            infowindow.open(map,marker);
        });
    }

    google.maps.event.addDomListener(window, 'load', initialize);

            </script>
    <style>
    html, body, #map-canvas {
                    height: 100%;
                    margin: 0px;
                    padding: 0px
                }

    #map-canvas{
            zoom: 0.7;
            -moz-transform: scale(0.7);
            -webkit-transform: scale(0.7);

    }
    </style>
        <body>
            <div id="map-canvas"></div>
        </body>

谁能告诉我为什么在应用 css3 缩放属性后我没有得到指针。

最佳答案

请引用链接。 http://jsfiddle.net/6TkY4/1/

var mapOptions = {
                     center: new google.maps.LatLng(latitude, longitude),
                      zoom: 8,
                     mapTypeId: google.maps.MapTypeId.ROADMAP

                 };

If you want to change zoom size, then increase zoom property value in mapOptions.

另请引用您现在可以使用的 fiddle 示例。

http://jsfiddle.net/BHhrF/1/

不要在 % 值中设置 div 高度。请使用像素值。或者使用带像素的外部 div。以 % 表示的内部 div 高度。它会起作用。

关于css - 应用 css3 缩放属性后,谷歌地图图钉点击不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20218720/

相关文章:

javascript - 动态填充的谷歌地图侧边栏

html - 具有边框图像属性的嵌入式谷歌地图?

css - 突出显示元素然后过渡回原始颜色

jquery - Css 过渡不平滑 - 折叠、展开菜单

javascript - 使用百分比进行 css 转换以动画 dom 翻译的替代方法

css - 为什么 Bootstrap 4 在移动设备上不会中断?

css - 使用 Google Maps API 在 div 之上放置 div

javascript - 如何根据值动态更改页面的CSS?

javascript - 谷歌地图 : How to create a custom InfoWindow?

css - 平滑过渡悬停图像