$.ajax({
url: "coords.json",
dataType: "json",
async: true,
success: function(msg){
google.maps.event.addDomListener(window, 'load', init);
function init() {
var mapOptions = {
zoom: 2,
center: new google.maps.LatLng(42, 10),
scrollwheel: false
};
var mapElement = document.getElementById('map');
var map = new google.maps.Map(mapElement, mapOptions);
setMarkers(map);
map.addListener('click', function() {
if (infowindow) {
infowindow.close();
}
});
}
function setMarkers(map) {
for (var n = 0; n < msg.length; n++) {
console.group('Path: '+n);
for (var i = 0; i < msg[n].length; i++) {
var m = i+1;
var mrk = msg[n][i];
var next_mrk = msg[n][m];
var marker = new google.maps.Marker({
position: {lat: mrk[1], lng: mrk[2]},
map: map,
icon: image,
title: mrk[0],
});
Message(marker, mrk[3]);
if(next_mrk) {
var dashedLine = new google.maps.Polyline({
path: [
{lat: mrk[1], lng: mrk[2]},
{lat: next_mrk[1], lng: next_mrk[2]}
],
strokeOpacity: 0,
icons: [{
icon: line,
offset: '0',
repeat: '6px'
}],
map: map
});
console.dirxml(mrk[0]+" - "+next_mrk[0]);
} else {
console.dirxml(msg[n][i][0]);
}
}
console.groupEnd();
}
}
function Message(marker, msg) {
var infowindow = new google.maps.InfoWindow({
content: msg
});
marker.addListener('mouseover', function() {
this.setIcon(image_hover); this.setZIndex(2);
infowindow.open(marker.get('map'), marker);
});
marker.addListener('mouseout', function() {
this.setIcon(image); this.setZIndex(1);
infowindow.close();
});
marker.addListener('click', function() {
marker.get('map').setZoom(6);
marker.get('map').setCenter(marker.getPosition());
});
}
}
});
<div class="grid__header">
<div class="grid__container">
<div class="grid__logo--header">
<h3>Site.<span>com</span></h3>
</div>
<div class="grid__menu">
<div class="menu__button" id="menu_button">
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
</div>
.grid__header {
position: fixed;
min-height: 164px;
height: 164px;
width: 100%;
}
.grid__header .grid__container {
display: -webkit-flex;
display: flex;
background: transparent;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-justify-content: space-between; /* Safari 6.1+ */
justify-content: space-between;
}
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'rowOptions'=>function ($model, $key, $index, $grid){
$class=$index%2?'odd':'even';
return [
'key'=>$key,
'index'=>$index,
'class'=>$class
];
},
]); ?>
<link href='style.css?v92' />
<script src='main.js?20160523'></script>
<?php
class BaseController extends \yii\web\Controller
{
private $_support;
public function beforeAction($action)
{
if (!parent::beforeAction($action)) {
return false;
}
$support = new ContactForm();
$this->_support = $support;
if ($support->load(Yii::$app->request->post())
&& $support->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('contactFormSubmitted');
return $this->refresh();
}
return true;
}
public function renderContent($content)
{
$layoutFile = $this->findLayoutFile($this->getView());
if ($layoutFile !== false) {
$layoutParams = [
'content' => $content,
'support' => $this->_support
];
return $this->getView()->renderFile($layoutFile, $layoutParams, $this);
} else {
return $content;
}
}
}