alias51
alias51

Reputation: 8608

How to disable an infowindow in googlemaps

Consider the following code that opens an infowindow in google maps:

google.maps.event.addListener(marker, 'click', function() {
    infowindow.open(map, marker);
});

Question: How can I disable the infowindow from showing if the window width is less than 900px?

I still want the code to work at widths above 900px.

Upvotes: 0

Views: 63

Answers (1)

StackSlave
StackSlave

Reputation: 10627

Try, something like:

google.maps.event.addListener(marker, 'click', function(){
  var ww = outerWidth || document.body.offsetWidth;
  if(ww > 900){
     infowindow.open(map, marker);
   }
});

Upvotes: 1

Related Questions