-
Posted in : Photographer
-
I see in the contact html code for a google map, but it doesn’t show in the demo or in the downloaded archive. I can see formatting for it in the css, but it doesn’t display.
Am I being dumb, but I can’t see a way to get this visible – the code looks OK, but nothing displayed.
Hi, yes there is google map code in the contact page but it is commented and not shown on demo site by default, but it should work fine if you just uncomment this code piece;
<div class="top-content"> <div class="map"> <div data-latitude="-25.363882" data-longitude="131.044922" data-zoom="5" id="map-canvas" class="map-canvas"></div> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> </div> </div>Ahhh, feel really stupid now. I was editing the page in notepad, and didn’t see it was commented out. Thanks again for the help.
One more quick question. I have seen other templates remove the controls from the google map. Doing a search I have found that the
disableDefaultUI: true
element removes the controls, but I’ve tried putting it in the css and html and neither seems to work.
Ideally I would also like to change the map to be black and white or greyscale.
Any ideas?
Hi again, edit
js/main.jsin a text editor, atline : 299you will see the codes related to google map, just replace it with this;// ------------------------------ // GOOGLE MAP /* custom map with google api check out the link below for more information about api usage https://developers.google.com/maps/documentation/javascript/examples/marker-simple */ function initializeMap() { if($('.map').length) { var styles = [{"featureType":"landscape","stylers":[{"saturation":-100},{"lightness":65},{"visibility":"on"}]},{"featureType":"poi","stylers":[{"saturation":-100},{"lightness":51},{"visibility":"simplified"}]},{"featureType":"road.highway","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"road.arterial","stylers":[{"saturation":-100},{"lightness":30},{"visibility":"on"}]},{"featureType":"road.local","stylers":[{"saturation":-100},{"lightness":40},{"visibility":"on"}]},{"featureType":"transit","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"administrative.province","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":-25},{"saturation":-100}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffff00"},{"lightness":-25},{"saturation":-97}]}]; var mapCanvas = $('#map-canvas'); var myLatlng = new google.maps.LatLng(mapCanvas.data("latitude"),mapCanvas.data("longitude")); var mapOptions = { zoom: mapCanvas.data("zoom"), center: myLatlng, disableDefaultUI: true, styles: styles } var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); var marker = new google.maps.Marker({ position: myLatlng, map: map }); } } if($('.map').length) { google.maps.event.addDomListener(window, 'load', initializeMap); } // ------------------------------That’s fantastic, thanks again. I didn’t think to dig through the js folder.
hi,
I have a problem with the google map on my site, I get the error: Oops! Something went wrong
I didn’t change your code.
Do you have any idea?Hi marek02,
Our developer will reply the topic here, please check out this page.
http://www.pixelwars.org/forums/topic/google-map-missing-api-key/
Thanks
You must be logged in and have valid license to reply to this topic.