BEE EEE
BEE EEE

Reputation: 49

Disable scroll and map/satallite options on google maps api?

<div id="map"></div>
<script>
function initMap() {
var uluru = {lat: 36.091732, lng: -115.228789};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 16,
center: uluru
});
var marker = new google.maps.Marker({
position: uluru,
map: map
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBotunmxwKg65qa-
Yex7o_eAyVZv_2QJo8&callback=initMap">
</script>

I have the map working on my site with this code. I'm trying to disable scrolling and get rid of the map/satellite options in the upper left corner.

Upvotes: 0

Views: 525

Answers (2)

Saurabh
Saurabh

Reputation: 2775

Try this:

var mapOptions = {
    zoom: 10,
    scrollwheel: false,
    mapTypeControl: false    
}

map = new google.maps.Map(document.getElementById("map"), mapOptions);

Bonus: To disable StreetView

streetViewControl: false

Upvotes: 0

Pommesloch
Pommesloch

Reputation: 502

In the Version 3 of Google Maps API you can use...

var map = new google.maps.Map(document.getElementById('map'), {
     zoom: 16,
     center: uluru,
     mapTypeControl: false,
     scrollwheel: false
});

Upvotes: 1

Related Questions