More

Display problem while using openlayers with jquery

Display problem while using openlayers with jquery


I want to use jquery with openlayers for rich interface. I have used layout-master for simple layout. But the problem is, when I add simple map using openlayers 'map' will not display at the center.!

         

It works fine if I use simple html(no jquery)

    

I am not able to find the error in my code.


Inside your first snippet (the one with jQuery support), try inverting the call toinit()andfinalizeLayout(), like this:

$(document).ready(function() { finalizeLayout(); init(); });

It seems that if you load your map first and then apply the layout, the map is resized and this affects its extent property. Therefore, you need to apply the layout first and then load your map; this way the extent you've defined in your code is respected.