36 lines
873 B
Plaintext
36 lines
873 B
Plaintext
/**
|
|
* Javascript to handle open street map for property single page.
|
|
*/
|
|
jQuery( function( $ ) {
|
|
'use strict';
|
|
|
|
if( typeof contactMapData !== "undefined" ) {
|
|
|
|
if( contactMapData.latitude && contactMapData.longitude ) {
|
|
|
|
var tileLayer = L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
attribution : '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
} );
|
|
|
|
var mapCenter = L.latLng( contactMapData.latitude, contactMapData.longitude );
|
|
var mapZoom = 14;
|
|
|
|
if( contactMapData.mapZoom ) {
|
|
mapZoom = contactMapData.mapZoom
|
|
}
|
|
|
|
var mapOptions = {
|
|
center : mapCenter, zoom : mapZoom
|
|
};
|
|
|
|
var contactMap = L.map( 'map-canvas', mapOptions );
|
|
contactMap.scrollWheelZoom.disable();
|
|
contactMap.addLayer( tileLayer );
|
|
|
|
L.marker( mapCenter ).addTo( contactMap );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} ); |