0

Its a very old question and I've tried all solutions available to go pass it without any success. I tried all the accepted answers without any success which makes me believe that I must be doing something wrong.

Below are the details:

Code looks something like this:

    // tab code example
        <li><a href="#tab1">Tab1</a></li>
        <li><a href="#tab2">Tab2</a></li>
        <li><a href="#tab3">Tab3</a></li>
        <li><a href="#tab4">Tab4</a></li>
        <li><a href="#tab5">Tab5</a></li>


        <div id="tab1" class="tab_content">
            <h2>Map1</h2>
        </div>
        <div id="tab2" class="tab_content">
            <h2>Map2</h2>
        </div>
        <div id="tab3" class="tab_content">
            <h2>Map3</h2>
        </div>
        <div id="tab4" class="tab_content">
            <h2>Map4</h2>
        </div>
         <div id="tab5" class="tab_content">
            <h2>Map5</h2>
        </div>
// tab example ends

I've already tried these answers:

Loading Google Maps in jQuery tab
Google Maps Not Working in jQuery Tabs
Google Map in Bootstrap Tab
Google Maps and jQuery Tabs
Google Maps unable to fully load in jquery nav-tab
Google Maps, Rails and Jquery
Google Maps and jQuery Tabs

Community
  • 1
  • 1
dhyan
  • 11
  • 3

1 Answers1

0

[OP's solution converted to answer below]

Finally what worked for me was including this in view specific js, so in my view.js i have :-

 $( "#tabs" ).bind( "click", function() {
        Gmaps.loadMaps();
    });

In view.html.erb :-

<%= gmaps(..)%> 
jam
  • 3,640
  • 5
  • 34
  • 50