var map=null; //global map object function init(){ var map = L.map('map', { center: [55.8, 10.4], zoom: 8, layers: [L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png')], maxBounds: [[54, 6],[58, 16]], zoomControl: false, attributionControl: false }); var waypoints = L.geoJson([],{ }).addTo(map); L.control.zoom({position: 'topright'}).addTo(map); L.control.attribution() .setPrefix(false) .addAttribution('© OpenStreetMap contributors, CC-BY-SA') .addTo(map); L.control.scale({imperial: false}).addTo(map); Modernizr.load([ { load: 'poi.js', callback: function() { waypoints.addData(data); } } ]); } Modernizr.load([ { test: Modernizr.rgba, nope: '/usr/share/javascript/leaflet/leaflet.ie.css' } ]);