Google maps infowindow not showing the tabs as it

2019-08-14 18:50发布

问题:

i had the info windows showing the tabs just fine a few weeks ago.. and now its not showing anymore...

In fact the code uses JQuery.. find the codes on this link http://code.google.com/p/gmaps-samples-v3/source/browse/trunk/infowindow/tabs.html?r=78

I have included all the libraries of JQuery including the CSS files.. what is wrong?... what puzzles me is that it was working for quite a while and suddenly stopped..what actually happened??

Any help would be appreciated:)

回答1:

If you haven't figured it out yet, or for others that might be having the same issue...

It appears to be a timing issue. $("#tabs").tabs() is being called prior to the tabs elements being created/visible/whatever. Activate the tabs by adding an event listener to "domready" which is fired once the content is actually added to the DOM.

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

    google.maps.event.addListener(infowindow, 'domready', function () {
        $("#tabs").tabs();
    });
});


回答2:

Just a friendly "Thank You" to cdru who supplied the solution above.

google.maps.event.addListener(infowindow, 'domready', function () { 
        $("#tabs").tabs();

This will fire the jQuery tabs method when the infoWindow is built !!!

Now, onto the next problem with sizing the infoWindow and removing the div scrollbars showing inside it.

Very nice, LA Guy