を入れてボタンの上にgoogleの地図
-
21-08-2019 - |
質問
たいと思い入れるボタンの上でGoogleマップの地図-衛星やハイブリッドボタンを押します。
破壊も修復もおもしろくなので、どのようなプレゼントしていきますか?
なアイデアいて重ね合わせ、画像の上にgoogleの地図はクリックできない場合、これはパクリ等に該当イベントから離れてます。
いかについて話し合う事ができる。
他のヒント
受け入れ答えは、2009年(5年前)とGoogle Maps APIの非推奨バージョンへのリンクからです。
非常に同じ質問を探している間、私はこの例を見つけた: https://developers.google.com/maps/documentation/javascript/examples/control-customする
// Create the DIV to hold the control and
// call the HomeControl() constructor passing
// in this DIV.
var homeControlDiv = document.createElement('div');
var homeControl = new HomeControl(homeControlDiv, map);
homeControlDiv.index = 1;
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
だけ補足Cannonadeの答えは、"わらびもち"をここではhtml/cssをGoogleマップ制御を利用します。複製する事ができ、cssをしてくれるだけで、本物さながらの出来上がり。●
することができ正式なGControlただけなのにして、Googleマップの絶対位置決めが可能です。
活動ボタン:
<div style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 5em; cursor: pointer; right: 15.3em;" title="Show street map">
<div style="border-style: solid; border-color: rgb(52, 86, 132) rgb(108, 157, 223) rgb(108, 157, 223) rgb(52, 86, 132); border-width: 1px; font-size: 12px; font-weight: bold;">
Map
</div>
</div>
休止ボタン:
<div style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 5em; cursor: pointer; right: 5.1em;" title="Show imagery with street names">
<div style="border-style: solid; border-color: white rgb(176, 176, 176) rgb(176, 176, 176) white; border-width: 1px; font-size: 12px;">
Hybrid
</div>
</div>
更新: また拡張機能のGoogleマップを用ライブラリを達成することができること- ExtMapTypeControl
私も同じ問題を抱えていた
、これは私がそれをやったか、ボタンを作成し、それを以下のスタイリングを与えることである。
のid = "my_buttonという"
#my_button{
position:absolute;
bottom:2%;
color: #fff;
background-color: #4d90fe;
padding: 11px;
border: 1px solid transparent;
border-radius: 2px;
box-sizing: border-box;
-moz-box-sizing: border-box;
outline: none;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
alignment-baseline:central;
width:90%;
left:5%;
text-align:center;
text-decoration:none;
margin:0px auto;}
#my_button:hover{
background-color:#3B6EC2;}
のjQueryを使用して、それは次のようになります。 まず、あなたの要素を返す関数を作成します。
function myButton(){
var btn = $('<div class="my-button"></div>');
btn.bind('click', function(){
// logic here...
alert('button clicked!');
});
return btn[0];
}
とマップが作成された後、あなたはそれにあなたのボタンを添付する必要があります:
map.controls[google.maps.ControlPosition.TOP_CENTER].push(myButton());
所属していません StackOverflow