- - PR -
googlemap windowサイズ変更
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2008-08-06 19:25
すいません、スレッドどこに立てるかわかりませんでした。。。
グーグルマップで、windowsのサイズ変更をしたら、地図の大きさも材レクトに変わるという処理をしたく、ウェブを参考に作ったのですが、 ローカルだと、firefox,opera,ie6でできるのですが、 HPにuploadすると、operaでしか実現できません。他のだと地図サイズが変化しません。 どなたかアドバイスいただけたら幸いです。 //<![CDATA[ //スクリプト定義 var map; var latLng = new GLatLng(43,14); // 初期位置設定 function load() { resize(); if (GBrowserIsCompatible()) { //Google Maps 利用可能? map = new GMap2(document.getElementById("map")); // マップ1 map.setCenter(latLng, 13); // 起動時初期位置 } } function resize(){ var map_obj=document.getElementById("map"); var disp=getDispSize(); map_obj.style.width=disp.width-100+"px"; map_obj.style.height=disp.height-100+"px"; } function getDispSize(){ if(document.all){ if(window.opera){ return {width:document.body.clientWidth,height:document.body.clientHeight}; } else { return {width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}; } } // NN else if(document.layers || document.getElementById){ return {width:window.innerWidth,height:window.innerHeight}; } } //]]> |
|
投稿日時: 2008-08-06 19:27
ちなみに、上記スクリプトをここから呼び出してます。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!--DTD(文書)宣言 XHTML仕様--> <html xmlns="http://www.w3.org/1999/xhtml"> <!--名前空間宣言 重複回避--> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <!--再度指定 ブラウザ誤差回避--> <title>マップ</title> <script src="http://maps.google.com/maps?file=api&v=2&key=xxx" type="text/javascript"></script> <script type="text/javascript" src="gmaps.js"> </script> </head> <body onresize="resize();" onload="load();" onunload="GUnload();"> <!--load設定--> <div id="map" style="width: 700px; height: 550px"></div> <!--map領域--> </body> </html> |
|
投稿日時: 2008-08-07 11:58
おそらく、yahooジオシティーズを使用してるのですが、対応してないことが原因となりそうです・・・。
|
1