質問

I am using marketclusterer object (http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer.js) for grouping multiple markers in one cluster when the map is zoomed out. Now I have an infobox which is shown when that marker cluster is clicked. I am doing that by this chunk of code:

 google.maps.event.addDomListener(markerCluster, 'clusterclick', function (cluster) {
            var content;
            var markers2 = cluster.getMarkers();
            for(var i=0;i<markers2.length;i++)
            {
                var marker = new google.maps.Marker({
                    position: myLatlng,
                    map: map,
                    title: data.title,
                    description: data.description,
                    companyname: data.companyname,
                    logofilename: data.logofilename,
                    postingid: data.postingid,
                    jobtitle: markers2[i].jobtitle
                }); 
                var testt = markers2[i].companyname;                    
                content += '<IMG BORDER="0" width="80" height="50" style="margin-right:5px;" ALIGN="Left" SRC='+ decodeURIComponent(markers[i].logofilename)+'>'+markers[i].companyname+'<br /> ' + '<a href='+'javascript:NewWindow('+"'"+'../JobSeeker/JobPostingApplication.aspx?PostingID='+markers[i].postingid+'&GetPosting=True'+"'"+')>' + markers[i].jobtitle+'</a><br /><br /> ';
            }                       
            infoWindow.setContent('<div style="width:210px;height:150px;">'+content+'</div>');

            var latLng = cluster.getCenter();
            //var myLatlng = new google.maps.LatLng(cluster.getCenter().ya, cluster.getCenter().za);               
            var myLatlng = new google.maps.LatLng(latLng.ob, latLng.pb);
            infoWindow.setPosition(myLatlng);
            infoWindow.open(map);
        });

I want to achieve the same thing with 'mouseover', but I tried both 'mouseover' and "mouseover" but nothing happens and no JS error is shown in the console. Do I need to call some other event for showing the infobox when the mouse is over the cluster? Thanks in advance, Laziale

役に立ちましたか?

解決

Try MarkerClusterPlus (per the documentation, it supports mouseover events (MarkerClusterer doesn't mention events).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top