[nette.ajax] google maps – ajax odkaz v info windows
- sepo
- Člen | 69
Ahoj
Ako nabindujeme odkaz vytvorený v google maps na ajax ?
Ajax na stránke mimo mapu funguje OK.
@layout.latte
<!DOCTYPE html>
<html lang="sk">
<head>
<meta charset="utf-8">
<script src="{$basePath}/bower_components/jquery/dist/jquery.js"></script>
<script src="{$basePath}/js/nette.ajax_2.3.0.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script>
<script>
$(function () {
$.nette.init();
});
</script>
</head>
<body>
{include #content}
</body>
</html>
default.latte
{block content}
<div id="map" style="height:860px"></div>
<script n:syntax="double">
var uluru = {lat: -25.363, lng: 131.044};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: uluru
});
var contentString = '<a href="'+{{link changeVariable!}}+'" class="ajax">Change variable!</a>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: uluru,
map: map,
title: 'Uluru (Ayers Rock)'
});
marker.addListener('click', function() {
infowindow.open(map, marker);
});
google.maps.event.addListener(map, 'idle', function() {
$.nette.load();
});
</script>
{/block}