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 求给定范围的全体素数p的(p-2)的连乘积
  • ¥15 VFP如何使用阿里TTS实现文字转语音?
  • ¥100 需要跳转番茄畅听app的adb命令
  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页