createGoogleMaps=function(id) { if($('#'+id).length) { var coordinate=new google.maps.LatLng(32.204188, -95.854027); var mapOptions= { zoom : 13, center : coordinate, scrollwheel : true, mapTypeControl : true, streetViewControl : false, }; var googleMap=new google.maps.Map(document.getElementById(id),mapOptions); var bounds = new google.maps.LatLngBounds(); var icons = new Array( { map : googleMap, position : new google.maps.LatLng(32.204188, -95.854027), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.20276959367472, -95.85413031706956), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.205310, -95.834927), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.0890148,-96.4828899), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.739163, -96.449254), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.331301, -96.114213), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.364998, -96.100737), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.170634, -96.014543), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } ); var content = new Array( '
' , '' , '' , '' , '' , '' , '' , '' ); var marker = new Array(); var info = new Array(); $.each(icons, function(k,v){ marker[k] = new google.maps.Marker(v); info[k] = new google.maps.InfoWindow({ content: content[k] }); bounds.extend(marker[k].position); marker[k].addListener('click', function() { for (var i = 0; i < icons.length; i++ ) { info[i].close(); } info[k].open(googleMap, marker[k]); }); }); googleMap.fitBounds(bounds); } $('#accordion .panel-title a').click(function(){ var ct = $(this).attr('data-marker'); googleMap.panTo(marker[ct].position); if(googleMap.getZoom() != 14){ googleMap.setZoom(14); } google.maps.event.trigger(marker[ct], 'click'); setTimeout(function(){ $(window).trigger('resize').trigger('scroll'); },200) }); $('#filters a').click(function() { googleMap.fitBounds(bounds); $.each(info, function(k,v){ info[k].close(); }); }); }; createGoogleMaps('map');