window.location.href を 1 つだけ持つことはできますか?
問題は、クリックされたときにマーカーの最後のクリック機能が正しいことだけです。残りは出力が異なりますが(これは正しいです)、常に最後のURLを開きます。
cfloop に注意してください。
map = new google.maps.Map(document.getElementById("map"), options);
// Create an Array for the Markers
var markers = [];
<cfloop array="#rc.details.poi.getPageRecords()#" index="local.poi">
var latLng = new google.maps.LatLng(#local.poi.getpoiLat()#,#local.poi.getpoiLong()#);
//var iconImg = '/assets/images/pin-50.png';
<cfif !ArrayIsEmpty(local.poi.getimages())>
var iconImg = new google.maps.MarkerImage("http://#CGI.HTTP_HOST#/plugins/api/index.cfm/image/#local.poi.getimages()[1].getimageID()#/50/50/get?apiKey=#application.factory.getBean('authenticationService').getAPIKey('image', 'GET')#&defaulttype=poi", null, new google.maps.Point(0,0), new google.maps.Point(0,0));
<cfelse>
var iconImg = new google.maps.MarkerImage("http://#CGI.HTTP_HOST#/plugins/api/index.cfm/image/1be71dec-a525-404f-a148-48ad74e46397/50/50/get?apiKey=#application.factory.getBean('authenticationService').getAPIKey('image', 'GET')#&defaulttype=poi", null, new google.maps.Point(0,0), new google.maps.Point(0,0));
</cfif>
var shadow = new google.maps.MarkerImage('/plugins/assets/images/AirTag50.png',
// The shadow image is larger in the horizontal dimension
// while the position and offset are the same as for the main image.
new google.maps.Size(50, 80),
new google.maps.Point(0,0),
new google.maps.Point(0, 7));
// Shapes define the clickable region of the icon.
// The type defines an HTML <area> element 'poly' which
// traces out a polygon as a series of X,Y points. The final
// coordinate closes the poly by connecting to the first
// coordinate.
var shape = {
coord: [1, 10, 10, 50, 55, 50,55 , 1],
type: 'poly'
};
var URLonClick = "#buildURL(action='public:scape.view',queryString='scapeID=#local.poi.getScape().getscapeID()#&airtag=#local.poi.getpoiID()#')#";
var marker = new google.maps.Marker({ position: latLng, map: map, draggable: false, title: 'Click to View AirTag', icon: iconImg, shadow: shadow, shape: shape, url: URLonClick });
// Action Listener for the Marker
google.maps.event.addListener(marker, 'click', function(event) {
window.location.href = marker.url;
});
markers.push(marker);
</cfloop>
var mcOptions = {gridSize: 50, maxZoom: 15};
var markerCluster = new MarkerClusterer(map, markers, mcOptions);