On Tue, Aug 17, 2010 at 11:04 AM, Stefan Schwarzer
<[email protected]> wrote:
> Hi there,
>
> I am trying to make available some "shortcuts" to the user, meaning that at 
> the right side of the Mappanel, there are some names on which the user can 
> click to zoom directly to these regions/towns.
>
> However, I don't get how this could be implemented. I searched quite some 
> while on the Net, but couldn't really find an answer. I guess that it's not 
> too difficult to implement; I am just not too familiar with Javascript. What 
> I came up so far is something like:
>
>        <a href="#" onclick="mapdiv = document.getElementById('map'); 
> mapdiv.setCenter(6, 45); mapdiv.zoomTo(10);">.....</a>
>

I've been experimenting with this just now - here is what I came up with:

 var clicker = (function(data) {
            return function (){
                var lon = data.longitude;
                var lat = data.latitude;
                // alert(lon+','+lat);
                map.setCenter( new
                OpenLayers.LonLat(lon,lat),8,false,true);
            };
        })(d);
 Ext.get("div"+i).on('click',clicker);

Where div0, div1 etc are div's that surround the place names in my list.

Hope this helps

Ian
-- 
Ian Turton
_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to