-1
マウスオーバーでマーカーのグラフィックを変更するために私のコードが機能しないのはなぜですか?各mouseover/mouseout関数にmarker.setIconがありますが、動作していないようです。Googleマップはマウスオーバー時にマーカーグラフィックを変更します
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
\t \t \t \t
\t \t \t \t var marker, i;
\t \t \t \t \t var id = 'sites';
\t \t \t \t \t
\t \t \t \t \t for (i = 0; i < locations_beer.length; i++) {
\t \t \t \t \t
\t \t \t \t \t var id = 'sites' + i;
\t \t \t \t \t
\t \t \t \t \t var contentString = '<div class="beer-map-popup">'+ locations_beer[i][0] +'<br /><img src="_img/beer-map-popup-wheat.png" border="0" /></div>';
\t \t \t \t \t \t \t
\t \t \t \t \t var infowindow = new google.maps.InfoWindow({
\t \t \t \t \t content: contentString
\t \t \t \t \t });
\t \t \t
\t \t \t
\t \t \t \t \t
\t \t \t \t \t marker = new google.maps.Marker({
\t \t \t \t position: new google.maps.LatLng(locations_beer[i][1], locations_beer[i][2]),
\t \t \t \t map: map
\t \t \t \t \t \t ,id: id
\t \t \t \t \t \t ,icon: 'http://www.ashtonbrewingcompany.com/_img/beermap-pin.png'
\t \t \t \t \t \t ,url: locations_beer[i][4]
\t \t \t \t \t \t ,zIndex:100
\t \t \t \t \t });
\t \t \t \t \t
\t \t \t \t \t var icon1 = "http://www.ashtonbrewingcompany.com/_img/beermap-pin-active.png";
\t \t \t \t \t var icon2 = "http://www.ashtonbrewingcompany.com/_img/beermap-pin.png";
\t \t \t \t
\t \t \t \t \t (function(infowindow) {
\t \t \t
\t \t \t \t \t google.maps.event.addListener(marker, 'mouseover', function() {
\t \t \t \t \t infowindow.open(map, this);
\t \t \t \t \t \t \t \t marker.setIcon("http://www.ashtonbrewingcompany.com/_img/beermap-pin-active.png");
\t \t \t \t \t });
\t \t \t \t \t
\t \t \t \t \t google.maps.event.addListener(marker, 'mouseout', function() {
\t \t \t \t \t infowindow.close();
\t \t \t \t \t \t \t \t marker.setIcon("http://www.ashtonbrewingcompany.com/_img/beermap-pin.png");
\t \t \t \t \t });
\t \t \t \t \t })(infowindow);
\t \t \t \t
\t \t \t \t \t
\t \t \t }
。働いた。ありがとう。 – user1110562