I am building a page with 1500+ markers on a Google Map, using the excelent gmaps.js. Something I can't figure out (being a bit of a javascript newb) is how I can display my infoWindow
content in a sidebar div outside the Google Map when a marker is clicked. I've found one example here, but I'm having trouble turning that into something that'd work with gmaps.js.
The solution seems to be a javascript function for a click event that would insert the infoWindow
data into a div with a specified ID. Here's what I have so far in my script (all the {{}}
is from using a Jinja2 template as my website is built with Python/Flask).
<script>
var map = new GMaps({
el: '#map',
lat: 39.829140,
lng: -98.579469,
zoom: 5
});
{% for port, latt, longg in coords %}
map.addMarker({icon: "{{ url_for('static', filename='img/icon.png') }}",lat:{{latt}},lng:{{longg}},title:"{{store}}",infoWindow:{content:'<p>{{port}}</p>'}});
{% endfor %}
</script>
So, how can I put the infoWindow
into a div outside the map?