简体   繁体   中英

mouseover for markerclusterer object

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

尝试MarkerClusterPlus (根据文档,它支持鼠标悬停事件( MarkerClusterer没有提及事件)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM