如何从javascript函数改变标记的位置? [英] How to change the position of marker from a javascript function?
本文介绍了如何从javascript函数改变标记的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须从JavaScript函数更改Google地图上的标记位置。
function changeMarkerPosition(marker){
var latlng = new google.maps.LatLng(-24.397,140.644);
marker.setPosition(latlng);
}
I have to change the position of a marker on Google map from a javascript function. How can I achieve that?
解决方案
You can use setPosition function of the marker class
function changeMarkerPosition(marker) {
var latlng = new google.maps.LatLng(-24.397, 140.644);
marker.setPosition(latlng);
}
这篇关于如何从javascript函数改变标记的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文