Take a look at this code I wrote...
var styles = [
{
"featureType": "landscape",
"stylers": [
{"weight": 0.1},
{"color": "#E7EDEF"}
]
},
...
{
"featureType": "poi.park",
"elementType": "labels",
"stylers": [
{"visibility": "on"}
]
}
];
var map;
function initialize() {
var centerM = new google.maps.LatLng(42.641185, 14.015790);
var iconBase = window.location.origin + Drupal.settings.basePath + 'sites/default/themes/actomedia/img/';
var mapOptions = {
zoom: 15,
center: centerM,
mapTypeId: google.maps.MapTypeId.ROADMAP,
styles: styles,
scrollwheel: false
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
// Map Marker & infoBox
markerOpt = {
map: map,
icon: iconBase + 'puntoEnergy_map_ico.png',
title: 'Punto Energy',
animation: google.maps.Animation.DROP
};
markerPicasso = new google.maps.Marker($.extend({position: centerM}, markerOpt));
}
google.maps.event.addDomListener(window, 'load', initialize);
The map displays correctly in Chrome and Firefox, but the marker is not visible in Internet Explorer.
Does anyone know how to solve this issue?
I have tried removing the marker animation and checking for any syntax errors in the code, but the problem persists.
--- UPDATE! ---
In response to Anto Jurković's question, I attempted to print the icon URL and discovered a bug where window.location.origin returns as undefined for me.
To resolve this, I added the following code snippet at the beginning of the JavaScript file (source):
if (!window.location.origin) {
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
}