Програма Інформаційні технології проектування
Скачать 1.28 Mb.
|
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDlZmXaMoW9gWqIsT3RMSDsJyixudAl4bI&libraries =places&callback=initMap" async defer> > Замовити екскурсію" /> @endsection ДОДАТОК В ЛІСТИНГ ВІДОБРАЖЕННЯ СТВОРЕННЯ МАРШРУТУ var map; var waypoints function initMap() { var mapLayer = document.getElementById("map-layer"); var centerCoordinates = new google.maps.LatLng(50.45, 30.52); var defaultOptions = { center: centerCoordinates, zoom: 10 } map = new google.maps.Map(mapLayer, defaultOptions); var directionsService = new google.maps.DirectionsService; var directionsDisplay = new google.maps.DirectionsRenderer; directionsDisplay.setMap(map); $("#drawPath").on("click",function() { waypoints = Array(); $('.toggle-heart1:checked').each(function() { waypoints.push({ location: $(this).next('.location').val(), stopover: true }); }); var locationCount = waypoints.length; if(locationCount > 0) { var start = waypoints[0].location; var end = waypoints[locationCount-1].location; drawPath(directionsService, directionsDisplay,start,end); }}); } function drawPath(directionsService, directionsDisplay,start,end) { directionsService.route({ origin: start, destination: end, waypoints: waypoints, optimizeWaypoints: true, travelMode: "WALKING" }, function(response, status) { if (status === 'OK') { directionsDisplay.setDirections(response); } else { window.alert('Problem in showing direction due to ' + status); } }); } $(document).ready(function(){ $(".fa-search").click(function(){ $(".container, .input").toggleClass("active"); $("input[type='text']").focus(); });}); |