Skip to content
Snippets Groups Projects
Commit a345fcf4 authored by Cédric Krier's avatar Cédric Krier :atom:
Browse files

Move document ready call to setup map in all.js

jQuery may not be yet loaded when the inline javascript is run.
parent a189a8a5
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
'node_modules/wowjs/dist/wow.min.js', 'node_modules/wowjs/dist/wow.min.js',
'node_modules/leaflet/dist/leaflet.js', 'node_modules/leaflet/dist/leaflet.js',
'js/wow.js', 'js/wow.js',
'js/highlight.pack.js']) 'js/highlight.pack.js',
'js/map.js'])
.pipe(concat('all.js')) .pipe(concat('all.js'))
.pipe(gulp.dest('static/js/')); .pipe(gulp.dest('static/js/'));
}); });
......
$(document).ready(function() {
if (typeof setupMap !== 'undefined') {
setupMap();
}
});
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
{% block script %} {% block script %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { function setupMap() {
L.Icon.Default.imagePath = '/static/images/'; L.Icon.Default.imagePath = '/static/images/';
var map = L.map('map').setView([0, 0], 1); var map = L.map('map').setView([0, 0], 1);
L.tileLayer('//{s}.tile.osm.org/{z}/{x}/{y}.png', { L.tileLayer('//{s}.tile.osm.org/{z}/{x}/{y}.png', {
...@@ -57,6 +57,6 @@ ...@@ -57,6 +57,6 @@
.bindPopup('<a href="#' + name.toLowerCase() + '">' + name + '</a>'); .bindPopup('<a href="#' + name.toLowerCase() + '">' + name + '</a>');
}); });
}); });
}); }
</script> </script>
{% endblock script %} {% endblock script %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment