0

I can't get to see the google map on my Jquery ui tabs that I created, I can see the frame but no map location or anything. What Do I need to do to fix this?

What I tried to do is a Jquery ui Tabs i.e 3 tabs and one has a small JavaScript Google Map

 <script src="https://maps.googleapis.com/maps/api/js"></script> <script> $(document).ready(function() { $(function() { $( "#tabs" ).tabs(); }); }); function initialize() { var mapCanvas = document.getElementById('map'); var mapOptions = { center: new google.maps.LatLng(2.0333, 45.3500), zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(mapCanvas, mapOptions) } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body> <div class="container"> <div class="jumbotron"> <h1>Lorem ipsum</h1> </div> </div> <div class="container"> <div class="row"> <div class="col-sm-12"></div> <img src="image1.jpg" class="img1" alt="Cinque Terre" width="800" height="490"> <div id="tabs"> <ul> <li><a href="#tabs-1">Lorem ipsum</a></li> <li><a href="#tabs-2">Lorem ipsum</a></li> <li><a href="#map">Lorem ipsum</a></li> </ul> <div id="tabs-1"> <p>l lorem ipsum jfsdjkng jkgndksjgn djkndsjkgns lorem ipsum jfsdjkng jkgndksjgn djkndsjkgnsorem ipsum jfsdjkng jkgndksjgn djkndsjkgns </p> </div> <div id="tabs-2"> <form role="form"> <label class="radio-inline"> <input type="radio" name="optradio">lorem Star </label> <label class="radio-inline"> <input type="radio" name="optradio">lorem Star </label> <label class="radio-inline"> <input type="radio" name="optradio">lorem Star </label> </form> <br> </div> <div id="map"></div> </div>

 #map { width: 300px; height: 280px; }

4
  • Could someone direct me to an example or a page which could give me a clue in how I would figure this problem out Commented Dec 30, 2015 at 0:14
  • Search StackOverflow for similar (or duplicate) questions. Commented Dec 30, 2015 at 0:19
  • You may want to check question 22111346 - google-map-api-with-jquery-tab. Commented Dec 30, 2015 at 14:51
  • @LexJulienne I cant get it to work Commented Dec 30, 2015 at 21:23

1 Answer 1

1

Call initialize() inside the $(document).ready function and remove google.maps.event.addDomListener(window, 'load', initialize); Also, give some width and height to the #map div in your css, if you haven't done this already

Sign up to request clarification or add additional context in comments.

2 Comments

Yeah I have #map { width: 300px; height: 280px; }
How would I place the map plugin inside a jquery ui tab ??

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.