Created
October 31, 2022 05:36
-
-
Save manchumahara/64f507f362f89dae40ea35159a2c3e2a to your computer and use it in GitHub Desktop.
iChaaangeee map js changes to fix the classic style loading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Contact form map start | |
var map_id = $('#map_canvas'); | |
if (map_id.length > 0) { | |
var $lat = map_id.data('lat'), | |
$lng = map_id.data('lng'), | |
$zoom = map_id.data('zoom'), | |
$maptitle = map_id.data('maptitle'), | |
$mapaddress = map_id.data('mapaddress'), | |
mymap = L.map('map_canvas').setView([$lat, $lng], $zoom); | |
//L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { | |
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { | |
//attribution: 'Map', | |
attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>', | |
maxZoom: 18, | |
//id: 'mapbox.streets', | |
id: 'mapbox/streets-v11', | |
scrollWheelZoom: false, | |
accessToken: 'pk.eyJ1Ijoic2hha2lsYWhtbWVlZCIsImEiOiJjamk4anF6NDgwMGd5M3BwM2c4eHU5dmIzIn0.yBLGUAB8kV1I1yGGonxzzg' | |
}).addTo(mymap); | |
var marker = L.marker([$lat, $lng]).addTo(mymap); | |
marker.bindPopup('<b>' + $maptitle + '</b><br>' + $mapaddress).openPopup(); | |
}//Contact form map end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment