Open BronzeCrab opened 8 years ago
@BronzeCrab which JS files are you referring?
@BronzeCrab that {{fullmap.js}}
is a template tag which will render the JS content of https://github.com/rochacbruno/Flask-GoogleMaps/blob/master/flask_googlemaps/templates/googlemaps/gmapjs.html replacing variables with values provided in the fullmap view.
Ok, I see. Can I somehow paste gmapjs.html
into my repo, so I want it to be part of my project, because I want to add some logic in it. Is it possible? Or maybe can I modify map after work of gmapjs.html? I've tried to do it like so:
{% block additional_head %}
{{ estates_map.js }}
{% endblock %}
{% block page_content %}
<script type="text/javascript">
$(document).ready(function () { initialize(); });
function initialize() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
estates_map.setCenter(new google.maps.LatLng(
position.coords.latitude, position.coords.longitude));
});
}
else {
estates_map.setCenter(new google.maps.LatLng(55.7558, 37.6173));
}
}
</script>
...
{{estates_map.html}}
but I have error:
Uncaught TypeError: estates_map.setCenter is not a function
Please add some examples of js files, like fullmap.js