Make browser history work.
--- a/src/iconolab/templates/iconolab/detail_image.html Fri Feb 24 16:17:50 2017 +0100
+++ b/src/iconolab/templates/iconolab/detail_image.html Thu Feb 23 20:27:39 2017 +0100
@@ -161,17 +161,19 @@
}, 600);
}
- function router () {
+ function router (scroll) {
var url = location.hash.slice(1);
if (url.length) {
var annotation = url;
var $el = $('.list-group a[data-annotation-id="'+annotation+'"]');
displayAnnotation($el);
- scrollTo($el.closest('.panel'), $el);
+ if (scroll) {
+ scrollTo($el.closest('.panel'), $el);
+ }
}
}
- // window.addEventListener('hashchange', router);
- window.addEventListener('load', router);
+ window.addEventListener('hashchange', function() { router(false) });
+ window.addEventListener('load', function() { router(true) });
</script>
{% endblock %}