Advertisement
j3d247

map.js

Feb 26th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.86 KB | None | 0 0
  1. $(document).ready(function() {
  2.     var lgmap;
  3.     function initialize() {
  4.         // Get Lat,Lng
  5.         var geo = new google.maps.Geocoder;
  6.         var lat;
  7.         var lng;
  8.         var address = $("#latlng").text();
  9.         geo.geocode({'address':address},function(results, status){
  10.             if (status == google.maps.GeocoderStatus.OK) {
  11.                 lat = results[0].geometry.location.d;
  12.                 lng = results[0].geometry.location.e;        
  13.                 latLng = new google.maps.LatLng(lat,lng);
  14.                 // Map Settings
  15.                 var mapOptions = {
  16.                   center: latLng,
  17.                   zoom: 15
  18.                 };
  19.                 var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); // Creates Map
  20.                 var lgmap = new google.maps.Map(document.getElementById("lgMap"), mapOptions); // Creates Map
  21.                
  22.                 // Map Marker
  23.                 var marker = new google.maps.Marker({
  24.                     position: latLng,
  25.                     map: map,
  26.                     title:"European Auto Visalia"
  27.                 });
  28.                 var lgmarker = new google.maps.Marker({
  29.                     position: latLng,
  30.                     map: lgmap,
  31.                     title:"European Auto Visalia"
  32.                 });
  33.             } else {
  34.                 alert("Geocode was not successful for the following reason: " + status);
  35.             }
  36.         });
  37.     };
  38.     // Expand Map On Click
  39.     $("#expandmap").click(function() {
  40.         $("#mapModal").foundation('reveal', 'open');
  41.         $(document).on('opened', '[data-reveal]', function () { //Fired upon modal opened completion
  42.             google.maps.event.trigger(lgmap, 'resize'); // Problem Seems To Be Here?
  43.         });
  44.     });
  45.     google.maps.event.addDomListener(window, 'load', initialize);
  46. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement