And you should be careful mixing inline <script> content with deferred <script> unless you understand the dependencies of your code and the order in which the JavaScript files are run. I recommend putting all your JavaScript in a .js file that you load with <script src="..." defer></script>. Deferred scripts will be run in order they are referenced in the html.
Kind regards, Ben. On 28/12/15 12:07, Ben Caradoc-Davies wrote: > You still have two map divs: > > <div id="map"></div> > > It is invalid HTML to have more than one element with id=map". This will > confuse OpenLayers. And where is the script to load ol3-layerswitcher.js? > > The html+javascript from the GeoServer page has a lot of complex > features. Perhaps start with a simpler page and add functionality > incrementally? > > Kind regards, > Ben. > > On 28/12/15 11:02, epyks23 wrote: >> Like this? index2.html >> <http://osgeo-org.1560.x6.nabble.com/file/n5243038/index2.html> >> >> I am using only one script that loads ol.js >> >> And the layerswitcher.js is defer and inside the body. >> >> >> >> >> -- >> View this message in context: >> http://osgeo-org.1560.x6.nabble.com/Creating-a-legend-in-Geoserver-tp5242993p5243038.html >> Sent from the GeoServer - User mailing list archive at Nabble.com. >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Geoserver-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geoserver-users >> > -- Ben Caradoc-Davies <[email protected]> Director Transient Software Limited <http://transient.nz/> New Zealand ------------------------------------------------------------------------------ _______________________________________________ Geoserver-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
