I am trying to make a map with shiftzoom.js
I have the following code snippet:
function selectall() {
for (i in geodata['world']) {
var q = getGeoPosition('world', i.toUpperCase(), 1654, 496, 1350, 407);
shiftzoom.construct($('world'), [{
x: q.l,
y: q.t,
w: 40,
h: 40,
id: geodata['world'][i].lc,
pos: 0,
title: '',
href: "javascript:get_lake(i); ",
target: 'graphFrame',
src: 'images/bullet.gif'
}]);
cvi_tip.add(cvi_tip.$(geodata['world'][i].lc), '<small>Province:</small><br/><big><b><u>' + geodata['world'][i].ln + '</u></b></big><br/><small>LAT/LONG:</small><br/><big><b>' + geodata['world'][i].coord + '</b></big><br/><small>PROVINCE:</small><br/><big><b><i>' + geodata['world'][i].pr + '</i></b></big>');
}
}
I am positioning dots to represent lakes on the map and I would like it to zoom in when the dot is clicked. This is what the function get_lake does, but every dot I click shows zooms in to the last value of "i". I have tried using closures like so:
href:"javascript:function(num){return function(){get_lake(num);};}(i);"
but I might not be using it properly since this code doesn't run. Does anyone know how to code it so that the function calls the current variable instead of the last one?
Thanks