Scroll to annotation on page load.
--- a/src/iconolab/templates/iconolab/detail_image.html Wed Feb 22 18:42:39 2017 +0100
+++ b/src/iconolab/templates/iconolab/detail_image.html Thu Feb 23 11:49:47 2017 +0100
@@ -31,7 +31,7 @@
</div>
{% else %}
<div class="panel-body">
- <div class="alert alert-warning">Pas d'annotation pour cette image</div>
+ <div class="alert alert-warning text-center">Pas d'annotation pour cette image</div>
</div>
{% endif %}
</div>
@@ -155,12 +155,19 @@
location.hash = '';
});
+ function scrollTo($container, $el) {
+ $container.animate({
+ scrollTop: $container.scrollTop() - $container.offset().top + $el.offset().top
+ }, 600);
+ }
+
function router () {
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);
}
}
// window.addEventListener('hashchange', router);