Il 18/02/2012 20:32, Anthony ha scritto:
If you're using jQuery, maybe you can just move the init() function contents into:

$(function () {
    var map, layer;
    map = new OpenLayers.Map('map');
    layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
    map.addLayer(layer);
    map.setCenter(
        new OpenLayers.LonLat(-71.147, 42.472).transform(
            new OpenLayers.Projection("EPSG:4326"),
            map.getProjectionObject()
        ), 12
    );
});

and put that after the {{extend 'layout.html'}} (still inside the script tag, of course). In that case, the code won't be run until the document ready event.

Anthony

hello Antony,
thanks for your replay... I've just tryed your solution but without success... do I have to explicity call the function after the definition you suggest? jQuery lib is loaded in the page...

cheers

    Manuele

Reply via email to