İlk temizlik tamamlandı bir önceki projeden
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
|
||||
* Document : be_comp_maps_google.js
|
||||
|
||||
* Author : pixelcave
|
||||
|
||||
* Description: Custom JS code used in Google Maps Page
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// Gmaps.js, for more examples you can check out https://hpneo.github.io/gmaps/
|
||||
|
||||
class BeCompMapsGoogle {
|
||||
|
||||
/*
|
||||
|
||||
* Init Search Map functionality
|
||||
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
static initMapSearch() {
|
||||
|
||||
if (jQuery('#js-map-search').length) {
|
||||
|
||||
// Init Map
|
||||
|
||||
let mapSearch = new GMaps({
|
||||
|
||||
div: '#js-map-search',
|
||||
|
||||
lat: 20,
|
||||
|
||||
lng: 0,
|
||||
|
||||
zoom: 2,
|
||||
|
||||
scrollwheel: false
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// When the search form is submitted
|
||||
|
||||
jQuery('.js-form-search').on('submit', (e) => {
|
||||
|
||||
let inputGroup = jQuery('.js-search-address').parent('.input-group');
|
||||
|
||||
|
||||
|
||||
GMaps.geocode({
|
||||
|
||||
address: jQuery('.js-search-address').val().trim(),
|
||||
|
||||
callback: (results, status) => {
|
||||
|
||||
if ((status === 'OK') && results) {
|
||||
|
||||
let latlng = results[0].geometry.location;
|
||||
|
||||
|
||||
|
||||
mapSearch.removeMarkers();
|
||||
|
||||
mapSearch.addMarker({ lat: latlng.lat(), lng: latlng.lng() });
|
||||
|
||||
mapSearch.fitBounds(results[0].geometry.viewport);
|
||||
|
||||
|
||||
|
||||
inputGroup.siblings('.form-text').remove();
|
||||
|
||||
} else {
|
||||
|
||||
inputGroup.after('<div class="font-text text-danger text-center animated fadeInDown">Address not found!</div>')
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
* Init Satellite Map
|
||||
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
static initMapSat() {
|
||||
|
||||
if (jQuery('#js-map-sat').length) {
|
||||
|
||||
new GMaps({
|
||||
|
||||
div: '#js-map-sat',
|
||||
|
||||
lat: 20,
|
||||
|
||||
lng: 0,
|
||||
|
||||
zoom: 2,
|
||||
|
||||
scrollwheel: false
|
||||
|
||||
}).setMapTypeId(google.maps.MapTypeId.SATELLITE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
* Init Terrain Map
|
||||
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user