dongshi1148 2014-07-28 08:33
浏览 35
已采纳

Yii render和renderPartial:谷歌地图没有正确显示[重复]

This question already has an answer here:

I am using Yii framework for my application and I have a this code below to initialize and show a simple google map with a layer I created in google maps engine.

<script>
    function initialize() {
        initialize2();
      var mapOptions = {
        zoom: 14,
        center: new google.maps.LatLng(14.154136802513362 ,121.26339912414551),
        mapTypeId: google.maps.MapTypeId.HYBRID
      };

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

      var mapsEngineLayer = new google.maps.visualization.MapsEngineLayer({
        layerId: '07732892464132847854-09507073323105492707',
        map: map
      });

    }

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

</script>
<div id="map-canvas" style="width:600px;height:600px;" ></div>

But my problem lies in the way it is rendered. When I use the yii renderPartial(), this is what this looks like :

RenderPartial

There is no problem here, the layer is fully shown and the window is complete. But I need to render it using the render() method because I need my themes, the navigations and other features of my application basically. But this is what ppears when I use the render() method :

Render

The tools on the left (zoom and pan buttons are not rendered properly, like clipped), and the layer doesn't appear, when I zoom in further I get this :

RenderZoom

The layers are kind of twisted, and plain wrong.

These run on the same code. The only difference is I render one using render() and the one displaying correctly is the renderPartial(), but I need to render it using the render() method.

This is really getting weird. Am I missing something with the render() and renderPartial() method? Help. Thanks!

</div>
  • 写回答

1条回答 默认 最新

  • dongshengli6384 2014-07-28 08:56
    关注

    Try this

           <style>
                #map-canvas img
                {
                    max-width: none;
                }
            </style>
    

    You use bootstrap 2? https://github.com/twbs/bootstrap/issues/1552

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭