/** * Whole-script strict mode syntax * * https://gist.github.com/jamigibbs/5a107b8e8ce854230a7c0dd5dc3f2442 * */ (function($) { 'use strict'; /** Fixit Google map **/ if( $('.fixit_front_google_map').length ){ $('.fixit_front_google_map').map(function(i) { var googleMap = $( this ).attr('id'); var map_lat = $( this ).attr('data-latitude'); var map_log = $( this ).attr('data-longitude'); var img = $( this ).attr('data-icon'); var myCenter = new google.maps.LatLng( map_lat, map_log ); function loc_initialize(){ var mapProp = { center:myCenter, zoom:9, scrollwheel: false, mapTypeId:google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById( googleMap ),mapProp); var marker = new google.maps.Marker({ position:myCenter, icon:img, }); marker.setMap(map); var infowindow = new google.maps.InfoWindow({ content:"Hello Address" }); var styles = [{ stylers: [ { hue: "#d4e5f8" }, { saturation: 10 } ] },{ featureType: "road", elementType: "geometry", stylers: [ { lightness: 50 }, { visibility: "simplified" } ] }, { featureType: "road", elementType: "labels", stylers: [ { visibility: "off" } ] } ]; map.setOptions({styles: styles}); } google.maps.event.addDomListener(window, 'load', loc_initialize); }); } /** Google map **/ if( $('.location_main_div').length ){ $('.location_main_div .event-map').map(function(i) { var googleMap = $( this ).attr('id'); var map_lat = $( this ).parent().find(".map_lat").attr('value'); var map_log = $( this ).parent().find(".map_log").attr('value'); var img = $( this ).parent().find(".map_image").attr('value'); var myCenter = new google.maps.LatLng( map_lat, map_log ); function loc_initialize(){ var mapProp = { center:myCenter, zoom:9, scrollwheel: false, mapTypeId:google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById( googleMap ),mapProp); var marker = new google.maps.Marker({ position:myCenter, icon:img, }); marker.setMap(map); var infowindow = new google.maps.InfoWindow({ content:"Hello Address" }); var styles = [{ stylers: [ { hue: "#d4e5f8" }, { saturation: 10 } ] },{ featureType: "road", elementType: "geometry", stylers: [ { lightness: 50 }, { visibility: "simplified" } ] }, { featureType: "road", elementType: "labels", stylers: [ { visibility: "off" } ] } ]; map.setOptions({styles: styles}); } google.maps.event.addDomListener(window, 'load', loc_initialize); }); } if( $('#contact_us_map').length ){ var map_lat = $('#contact_us_map').attr('data-lat'); var map_log = $('#contact_us_map').attr('data-log'); var img = $('#contact_us_map').attr('data-icon'); var myCenter = new google.maps.LatLng( map_lat, map_log ); function cont_initialize(){ var mapProp = { center:myCenter, zoom:9, scrollwheel: false, mapTypeId:google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById('contact_us_map'),mapProp); var marker = new google.maps.Marker({ position:myCenter, icon:img, }); marker.setMap(map); var infowindow = new google.maps.InfoWindow({ content:"Hello Address" }); }; google.maps.event.addDomListener(window, 'load', cont_initialize); } })(jQuery);