-1

I would like to make the contents of this infowindow to fit. I just fork this code from this post.

So far, I've manage to try the following links as the result of my research

  1. The first answer on this link seems to work in the year 2010, but no longer works in 2014, or maybe I'm just missing something.

It states that

set the maxWidth options property in the constructor. Yes, even if setting the maximum width was not what you wanted to do.

then one of the comment says that maybe this is working in year 2010 but not anymore in 2014

This may have worked in 2010, but does not help as of 2014. – Simon Aug 15 at 1:25

  1. This link replaces the "standard" google maps infowindow with our own style, but this doesn't work also to me.

What you want to do is replace the "standard" Googlemaps infoWindow with your own, and put your content into it. Once you replace the standard GM infoWindow, you have a lot of latitude to work with.

  1. I've also tried this, but the code doesn't fit my codes.

Below is the code that I've tried

 content: $(this.infocontent)[0]
  1. Lastly is this, which aims on resizing the infowindow but it doesn't work still.

    var infowindow = new google.maps.InfoWindow({ content: ..., maxWidth: 300 })

Something like this is the result that I want to get, when we click the marker, an infowindow that can autofit will show.

Community
  • 1
  • 1
Cary Bondoc
  • 2,923
  • 4
  • 37
  • 60
  • Is it still not enough to say that I just fork the code and state the references of what I have done so far? – Cary Bondoc Sep 30 '14 at 23:46
  • 1
    No. Saying *I tried this but it didn't work* or *this code doesn't fit my codes* will certainly not help anyone to help you. I even don't understand what you are trying to achieve and what doesn't work. – MrUpsidown Oct 01 '14 at 07:23
  • Okay, thanks! I'll revise the question. :) Edit: Oh no, the hyperlinks are wrong that's why you are confused. thanks I'll fix it. – Cary Bondoc Oct 02 '14 at 00:07

1 Answers1

0

This is not the fix, but just a work around. Didn't permanently fixed the problem.

It seems that by changing the code of this

var sites = [
            ['American Range', 34.2737729, -118.4284391, 1, "<a href=\"http://americanrange.com/\" target='_blank'>American Range</a>"],
            ['Gorenje', 46.3446568, 15.0064148, 1, "<a href=\"http://www.gorenje.com/\" target='_blank'>Gorenje</a>"]
        ];

To this

 var sites = [
        ['American Range', 34.2777032, -118.4238387, 1, '<p><a href=\"http://americanrange.com/\" target="_blank"><b>American Range</b></a></p></br>'],
        ['Gorenje', 46.4906673, 15.3754774, 1, '<p><a href=\"http://www.gorenje.com/\" target="_blank"><b>Gorenje</b></a></p></br>']
];

Specifically this

"<a href=\"http://americanrange.com/\" target='_blank'>American Range</a>"

To this

'<p><a href=\"http://americanrange.com/\" target="_blank"><b>American Range</b></a></p></br>'

Fixes the problem for certain marker, but not all.

enter image description here enter image description here

Cary Bondoc
  • 2,923
  • 4
  • 37
  • 60