7610

InfoWindow appears minimum size no matter what

Question:

There are several posts relating to this topic here but I've applied what seemed relevant on everything I read:

<strong>CSS</strong>

.infoWindow { width: 90px; height: 90px; }

<strong>Create InfoWindow and assign to marker</strong>

var infowindow = new google.maps.InfoWindow({ content: '<div class="infoWindow">Test</div>', maxWidth: 100 }); infowindow.open(map,test);

<strong>Result</strong>

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/JYc5n.png" data-original="https://i.stack.imgur.com/JYc5n.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

As you can see the InfoWindow appears at minimum size and no text is visible, this is also the case if I strip out the <div> tag and all styling parameters and just try to display "Test".

<a href="http://rlcoaching.com/albaraka/" rel="nofollow">You can check the live site yourself here (hover over top right of screen to display map)</a>

<strong>Why does the InfoWindow insist on staying at minimum size?</strong>

<strong>EDIT: Turns out this problem only happens on a "reload", IE: when page is cached. Every time I clear the cache it works fine, but if I reload page without clearing cache it displays like in the picture above. Tried on Firefox & Chrome, OSX</strong>

Answer1:

try this solution putting the content inside a variable.

var content='<div class="infoWindow">Test</div>'; var infowindow = new google.maps.InfoWindow({ content:content, maxWidth: 100 });

in the past I had similar problem and this worked.

<strong>update</strong>

I have removed some options from Infowindow according to <a href="https://developers.google.com/maps/documentation/javascript/infowindows#add" rel="nofollow">this</a> documentation.

<blockquote> <blockquote>

The InfoWindowOptions object literal contains the following fields: <br /> 1)content <br /> 2)position <br /> 3)maxWidth

</blockquote> </blockquote>

<strong>update 2</strong>

set min-height, min-width css property to your .infoWindow class

<strong>update 3</strong>

see <a href="https://stackoverflow.com/questions/19575796/force-google-infowindow-to-redraw-itself-or-refresh-its-content" rel="nofollow">this</a> stack question for your new problem

Recommend

  • Is Red-Black tree balanced
  • Virtualizing WrapPanel as ListView's ItemsTemplate
  • I have a modal that opens a second modal and cannot close the first modal if open then close the sec
  • Accessing another variable in the same class with a click event
  • How to configure Cygnus in relation to Orion and Cosmos
  • Why can't UI components be accessed from a backgroundworker?
  • How to log in to an HTTPS website with Jsoup?
  • PDO error when wrong host name
  • Is there a way to dynamically embed PDF Files in a JSP pulled from the file system?
  • Switch to popup in python using selenium
  • Salesforce Different WSDL files and when to use
  • How to autopopulate a field in SugarCRM form
  • Who propagate bugfixes across branches (corporate development)?
  • How to getText() from the input field of an angularjs Application
  • Web.config system.webserver errors
  • Differences in dis-assembled C code of GCC and Borland?
  • ADO and msqli connections very slow
  • How can the INSERT … ON CONFLICT (id) DO UPDATE… syntax be used with a sequence ID?
  • Problems compiling files using JOGL
  • CakePHP 2.0.4 - findBy magic methods with conditions
  • HTTP/2 streams vs HTTP/1.1 connections
  • Admob requires api-13 or later can I not deploy on old API-8 phones?
  • Python urlparse: small issue
  • Change multiple background-images with jQuery
  • Get one-time binding to work for ng-if
  • Display issues when we change from one jquery mobile page to another in firefox
  • Is there any way to access browser form field suggestions from JavaScript?
  • Android screen density dpi vs ppi
  • Deselecting radio buttons while keeping the View Model in synch
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • MySQL WHERE-condition in procedure ignored
  • JSON with duplicate key names losing information when parsed
  • Change an a tag attribute in JavaScript based on screen width
  • Web-crawler for facebook in python
  • Jquery - Jquery Wysiwyg return html as a string
  • A cron job substitute?
  • trying to dynamically update Highchart column chart but series undefined
  • LevelDB C iterator
  • Linking SubReports Without LinkChild/LinkMaster
  • java string with new operator and a literal