Commit 9df55edc8ce7b3d585457bab36165e15fe62bd05

Authored by Eugeny Galkovskiy
1 parent 342529c4

google maps

frontend/assets/AppAsset.php
... ... @@ -21,15 +21,15 @@
21 21 'css/custom.css',
22 22 ];
23 23 public $js = [
24   - '/js/jquery.cookie.js',
25   - '/js/waypoints.min.js',
26   - '/js/jquery.counterup.min.js',
27   - '/js/jquery.parallax-1.1.3.js',
28   - '/js/front.js',
29   - '/js/owl.carousel.min.js',
  24 + 'js/jquery.cookie.js',
  25 + 'js/waypoints.min.js',
  26 + 'js/jquery.counterup.min.js',
  27 + 'js/jquery.parallax-1.1.3.js',
  28 + 'js/front.js',
  29 + 'js/owl.carousel.min.js',
  30 + '//maps.googleapis.com/maps/api/js?key=AIzaSyCgyPQhOmGEwyAdZ0uS6fJLLvnNxgncfy0&callback=initMap',
30 31 '/js/gmaps.init.js',
31   - '//maps.google.com/maps/api/js?key=AIzaSyCmojIzU4lFDnNUQymI35wxbiNDME-4l_Y',
32   - '/js/script.js',
  32 + 'js/script.js',
33 33 ];
34 34 public $depends = [
35 35 'yii\web\YiiAsset',
... ...
frontend/web/js/gmaps.init.js
  1 +$(
  2 + function() {
1 3  
2   -function initMap() {
3   - var uluru = {lat: 50.4416887, lng: 30.5175961};
4   - var map = new google.maps.Map(document.getElementById('map'), {
5   - zoom: 4,
6   - center: uluru
7   - });
8   - var marker = new google.maps.Marker({
9   - position: uluru,
10   - map: map
11   - });
12   -}
13 4 \ No newline at end of file
  5 + function initMap() {
  6 + var myLatLng = {
  7 + lat: 50.4416887,
  8 + lng: 30.5175961
  9 + };
  10 +
  11 + var map = new google.maps.Map(
  12 + document.getElementById('map'), {
  13 + center: myLatLng,
  14 + scrollwheel: false,
  15 + zoom: 16
  16 + }
  17 + );
  18 +
  19 + var marker = new google.maps.Marker(
  20 + {
  21 + position: myLatLng,
  22 + map: map,
  23 + title: 'Hello World!'
  24 + }
  25 + );
  26 +
  27 + }
  28 +
  29 + window.initMap = initMap();
  30 + }
  31 +);
... ...