another map plugin
-
hello, can you help me with this plugin? the developer has not responded for 11 months.
He has a bug on his cell phone. When I drag the bookmark to an address it automatically returns itself to my current location. On the desktop this does not happen.
This plugin serves to share the current location for delivery delivery on woocomerce’s ckekolt.
“use strict”;
if(lat==” || lat==null ) {
var lat=”51.508742″;
}
if(long==” || long==null) {
var long=”-0.120850″;
}var supportGeolocation = false;
if (‘geolocation’ in navigator) {
navigator.geolocation.getCurrentPosition(function (position) {
lat = position.coords.latitude;
long = position.coords.longitude
});
supportGeolocation = true;
} else {
console.log(‘geolocation IS NOT available’);
}var myCenter=new google.maps.LatLng(lat,long);
function initialize()
{
var mapProp = {
center: myCenter,
zoom:parseInt(zoom),
mapTypeId: google.maps.MapTypeId.ROADMAP
};var map = new google.maps.Map(document.getElementById(“dlmmapdiv”),mapProp);
var marker = new google.maps.Marker({
position: myCenter,
draggable: true,
title:’Click to zoom’
});if (supportGeolocation)
{
navigator.geolocation.watchPosition(function (position) {
if (marker) {
marker.setMap(null);
}
var center = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
map.panTo(center);
marker = new google.maps.Marker({
position: center,
draggable: true,
zoom: 15,
map: map,
})marker.setMap(map);
google.maps.event.addListener(marker, ‘click’, function (event) {
document.getElementById(“delivery_location”).value = event.latLng.lat()+’,’+event.latLng.lng();});
google.maps.event.addListener(marker, ‘click’, function (event) {
document.getElementById(“delivery_location”).value = this.getPosition().lat()+’,’+this.getPosition().lng();});
google.maps.event.addListener(marker, ‘dragend’, function (event) {
document.getElementById(“delivery_location”).value = this.getPosition().lat()+’,’+this.getPosition().lng();});
});
}
else
{
marker.setMap(map);
google.maps.event.addListener(marker, ‘click’, function (event) {
document.getElementById(“delivery_location”).value = event.latLng.lat()+’,’+event.latLng.lng();});
google.maps.event.addListener(marker, ‘click’, function (event) {
document.getElementById(“delivery_location”).value = this.getPosition().lat()+’,’+this.getPosition().lng();});
google.maps.event.addListener(marker, ‘dragend’, function (event) {
document.getElementById(“delivery_location”).value = this.getPosition().lat()+’,’+this.getPosition().lng();});
}
}
google.maps.event.addDomListener(window, ‘load’, initialize);
The topic ‘another map plugin’ is closed to new replies.