I am having issues with my custom markers on a Google map. First one displays, the second one doesn't.
My JS:
var tout;
function myFunction() {
tout = setTimeout(initMap, 2500);
}
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 11,
center: {lat: 50.1821952, lng: 12.7067494}
});
var image = 'learn.png';
var SCMarker = new google.maps.Marker({
position: {lat: 50.1760219, lng: 12.6382292},
map: map,
icon: image
});
var image2 = 'home.png';
var HOMarker = new google.maps.Marker({
position: {lat: -50.1858299, lng: 12.7487256},
map: map,
icon: image2
});
The image file is okay. What could be the issue?
If images is ok, then change position: {lat: -50.1858299, lng: 12.7487256}
to {lat: 50.1858299, lng: 12.6382292}
and check. Icons should be nearly and you can see if icons renders or not.
Maybe it's because of " - ".
Hope it helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.