Google Map Api Disappears

paulwamail - November 17, 2008 - 01:47
Project:Magic Tabs
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Just to start off, I have been having fun with this module, but it is difficult to find answers since it's different than the jstools tabs. The main reason I chose it was due to the ajax loading function.

I can get a custom google map api working in the tab, but if I change tabs and go back it is no longer visible. Can some one provide a solution to this. I see solutions for jstools tabs, but can't get one to work in magic tabs.

Thank you

#1

yhager - November 17, 2008 - 03:59

Can you provide the code you used for your callback?

#2

paulwamail - November 17, 2008 - 04:19

The top of my module

function lake_layout_magic_tabs($active = 0) {
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $node = node_load(arg(1));
    node_build_content($node);
  }
The rest of the module is straight from the example and <?php print magic_tabs_get('lake_layout_magic_tabs'); ?> is what I pasted in the contemplate area. Then in the page.tpl I pasted my google api javascript. Initialized the google function with body onload. Then in my custom module I just put $test2 .= '<div id="map_canvas" style="width: 500px; height: 300px"></div>'; and then 'content' => $test2,.

I know this is super cude, but it is the best I know how to do for now. I'm learning everyday. I know just enough to be dangerous:)'

Thank you.

#3

webrascal - January 14, 2009 - 22:16

I'm doing a bit of hunting around trying to find which tabs module I should implement on my next project and having stumbled on this hopefully I could help you out here a bit.

What you may be experiencing is some race condition conflicts with your body onload call and the way jquery expects things to happen and in which order.

If I were you I'd look into getting your google map javascript executed through the jquery instead of the body onload call.

Have a read through here (http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery) to see if you can get your head into it a bit more, specifically this area:

$(document).ready(function() {
   // do stuff when DOM is ready
});

This may or may not fix your problem, but it could at least rule out race conditions being a problem.

Good luck!

 
 

Drupal is a registered trademark of Dries Buytaert.