var mymap = L.map('mapid', { maxZoom: 10, minZoom: 10, zoom: 0, crs: L.CRS.Simple, center: new L.LatLng(-100,300), }); //.setView([0, 0], 25); // L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { // attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox', // maxZoom: 100, // id: 'mapbox.streets', // accessToken: 'your.mapbox.access.token' // }).addTo(mymap); L.GridLayer.DebugCoords = L.GridLayer.extend({ createTile: function (coords) { var tile = document.createElement('p'); // var tileSize = this.getTileSize(); tile.setAttribute('width', '10px !important'); tile.setAttribute('height', '10px !important'); var openpop = false; setTimeout(function () { done(null, tile); // Syntax is 'done(error, tile)' }, 500 + Math.random() * 1500); function getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); } tile.innerHTML = '

'+ text2[getRandomInt(17)] + '

' ; return tile; } }); function closeOpen(){ } L.gridLayer.debugCoords = function(opts) { return new L.GridLayer.DebugCoords(opts); }; mymap.addLayer( L.gridLayer.debugCoords() );