0
gMap2를 사용 중이며 버튼을 클릭하면 마커 이미지가 "marker1.png"에서 "marker2.png"으로 변경하고 싶습니다..버튼을 클릭 할 때 마커 이미지 변경
// Declare the marker
var customMarker = "img/marker1.png";
// Initialize the map
$('#map').gMap({
address: "Paris, France, cité Nollez 3.",
zoom: 12,
markers:[
{
address: "Paris, France, cité Nollez 3.",
html: "_address"
}
],
icon: {
image: customMarker,
iconsize: [61, 63],
iconanchor: [12, 46]
}
});
// Change marker image on button click
$("button").click(function(){
customMarker === "img/marker2.png";
});
여기 jsFiddle은 다음과 같습니다 : http://jsfiddle.net/hrLga/
덕분에 많이 나는 다음과 같은 코드가 있습니다!
customMarker를 변경 한 후에 gMap을 다시 호출해야한다고 생각합니다. – Adam
감사합니다. 효과가있었습니다! – user2556272
@ Adam 귀하의 의견을 답변으로 제출하시면 문제가 해결 된 것으로 표시되어 크레딧을받을 수 있습니다. – RST