I am very new to the brochure, trying to duplicate a function on a four-quarter, highlight the click marker and reset it to the original manufacturer when you click on the map or another marker is selected and highlighted.
I am using jQuery Birdseye ( http://ajb.imtqy.com/jquery-birdseye/ ) to find out and get some kind of interactive map. I changed the numbered marker icon to a numbered sprite marker. The sprite works fine, and the position is controlled by a pin (0 = blue, 1 = highlighted, blue, 2 = orange, 3 = highlighted orange) and the “state” inside L.marker. I know that the click_marker Click function only sets the highlighted marker. could not find a solution to play the function, as on a four-quarter map, to highlight the marker when pressed. Please direct me in the right direction.
L.NumberedDivIcon = L.Icon.extend({
options: {
sprite:"images/mappin-sprite.png",
number: '',
iconSize: new L.Point(29, 39),
iconAnchor: new L.Point(15, 37),
gridSize: new L.Point(35, 45),
popupAnchor: new L.Point(0, -33),
shadowUrl:"images/mappin-shadow.png",
shadowSize:new L.Point(29, 15),
shadowAnchor:new L.Point(15, 10),
state: ''
},
createIcon: function () {
var div = document.createElement('div');
div.style.backgroundImage="url("+this.options.sprite+")";
div.className="leaflet-marker-icon";
div.style.marginLeft=-this.options.iconAnchor.x+"px";
div.style.marginTop=-this.options.iconAnchor.y+"px";
var b=this.options.gridSize||this.iconSize;
var c=this.options['number'] || '';
var cd=this.options['state'] || '';
var d= this.options.gridSize.y+this.options.iconSize.y+cd;
div.style.backgroundPosition=-(c*b.x+(b.x-this.options.iconSize.x)/2)+"px "+-(d*b.y+(b.y-this.options.iconSize.y)/2)+"px";
this._setIconStyles(div, 'icon');
return div;
},
createShadow: function () {
var a=this.options.shadowSize;
var img = this._createImg(this.options['shadowUrl']);
img.style.marginLeft=-this.options.shadowAnchor.x+"px";
img.style.marginTop=-this.options.shadowAnchor.y+"px";
img.style.width=a.x+"px",img.style.height=a.y+"px";
img.className="leaflet-marker-icon";
return img;
}
});
JQuery Birdseye Token Code
processResults = function(results) {
var marker, _i, _len;
settings.results_el.html('');
for (_i = 0, _len = markers.length; _i < _len; _i++) {
marker = markers[_i];
map.removeLayer(marker);
}
if (results.length > 0) {
return $(results).each(function(key, result) {
var new_marker;
if (result.women == true) {
var pin = 2;
}
else
{
var pin = 0;
}
new_marker = L.marker(settings.response_params_latlng(result),{
icon: new L.NumberedDivIcon({
number: key,
state: pin
})
});
function setHighlightIcon(e) {
new_marker = e.target;
var pinselected = pin+1;
new_marker.setIcon(new L.NumberedDivIcon({number: key, state:pinselected}));
new_marker.setZIndexOffset(+100)
}
function setDefaultIcon() {
var pindeselected = pin;
new_marker.setIcon(new L.NumberedDivIcon({number: key, state: pindeselected}));
}
new_marker.on({
'click': setHighlightIcon
});
markers.push(new_marker.addTo(map));
return settings.results_el.append(settings.results_template(key, result));
})
} else {
return settings.results_el.append(settings.no_results_template());
}
}