◆Google Maps API V3 のアイコン(マーカー)をスライドして移動可能にする。raiseOnDragの指定
移動可能なマーカー(アイコン)をドラッグ&ドロップ(飛び跳ねるアニメーションでなく、スライドさせる指定です。(飛び跳ねるアニメーションの場合はコチラ)
スケートリンクを移動させるイメージですな。
マーカー(アイコン)をスライドで移動できるようにするためには、draggableだけでなく、raiseOnDrag指定する必要があります。
なお、日本語リファレンスには、載っていないので英語版からの紹介です。
google.maps.MarkerOptions object specification の Propertiesの中段に raiseOnDragの説明があります。draggable: trueとした上で、 raiseOnDrag: false,を指定します。
◆Script
var marker = new google.maps.Marker(
{
map: map,
draggable: true,
raiseOnDrag: false,
animation: google.maps.Animation.DROP,
position: latlng,
icon: icon.icon,
shadow: icon.shadow,
title: name
});
◆Google Maps JavaScript API V3 サンプル
◆参照先
◆Google Maps JavaScript API V3
var marker = new google.maps.Marker(
{
map: map,
draggable: true,
raiseOnDrag: false,
animation: google.maps.Animation.DROP,
position: latlng,
icon: icon.icon,
shadow: icon.shadow,
title: name
});
関連記事一覧
スポンサードリンク
Leave a Comment