Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 8th, 2012  |  syntax: None  |  size: 1.26 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. google map not loading properly in magento tabs
  2. <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
  3. <script type="text/javascript">
  4.  var latLng;
  5. function initialize() {
  6. var map = new google.maps.Map(document.getElementById('map'), {
  7.     zoom: 8,
  8.     center: new google.maps.LatLng(26.937201,75.785672),
  9.     scrollwheel: true,
  10.     disableDefaultUI: true,
  11.     navigationControl: true,
  12.     mapTypeId: google.maps.MapTypeId.ROADMAP,
  13.  
  14. });
  15.  
  16.  
  17. var infoWindow = new google.maps.InfoWindow;
  18.  
  19. var onMarkerClick = function() {
  20.   var marker = this;
  21.   var latLng = marker.getPosition();
  22.   infoWindow.setContent("I'm here!!!!");
  23.  
  24.   infoWindow.open(map, marker);
  25. };
  26. google.maps.event.addListener(map, 'click', function() {
  27.   infoWindow.close();
  28. });
  29.  
  30.  
  31. var marker1 = new google.maps.Marker({
  32.   map: map,
  33.   position: new google.maps.LatLng(26.937201,75.785672)
  34. });
  35.  
  36.  
  37. google.maps.event.addListener(marker1, 'click', onMarkerClick);
  38.   }
  39.  var GMaps = Class.create();
  40. GMaps.prototype = {             }
  41. var gmaps = null;
  42. function switchGMapsTab(tab){
  43.     if ( tab.tab.container.activeTab.id == 'googlemap_tabs_id'){
  44.         if (!gmaps){
  45.                initialize();
  46.         }
  47.     }
  48. }
  49. varienGlobalEvents.attachEventHandler('showTab', switchGMapsTab);    
  50. </script>