I am using the JS API to display my map. Here is the code:
<script type="text/javascript">
function initialize() {
var _lat = 10;
var _long = 200;
var myLatlng = new google.maps.LatLng(_lat, _long);
var myOptions = {
center: myLatlng,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
var image = 'target.png';
var beachMarker = new google.maps.Marker({
position: myLatlng,
map: map,
icon: image
});
beachMarker.setMap(map);
}
</script>
Now i want to remove few things from the map.
How do i achieve this.
You can use the setOptions() method on the map object: map. setOptions({draggable: false, zoomControl: false, scrollwheel: false, disableDoubleClickZoom: true});
Disabling the UI Default Controls We can disable the default UI controls provided by Google Maps simply by making the disableDefaultUI value true in the map options.
scrollwheel: false,
This option is used for disable zoom on mouse.
scaleControl: false,
This option is used for disable zoom by scale.
draggable: false,
This option is used for disabling drag.
mapTypeControl: false,
This option will hide map type.
Put them as following:
var myOptions = {
center: myLatlng,
zoom: 15,
mapTypeControl: false,
draggable: false,
scaleControl: false,
scrollwheel: false,
navigationControl: false,
streetViewControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With