]> git.parisson.com Git - mezzo.git/commitdiff
Smooth scroll on summary links
authorJérémy Fabre <Jeremy@iMac-de-Jeremy.local>
Tue, 8 Nov 2016 10:59:25 +0000 (11:59 +0100)
committerJérémy Fabre <Jeremy@iMac-de-Jeremy.local>
Tue, 8 Nov 2016 10:59:25 +0000 (11:59 +0100)
app/static/src/js/modules/summary.js

index 9db79ef8576c37c7f9d3723660213cc64e6563ca..ae0a8b5a08b64732740e51e00368b8fc04f4f636 100644 (file)
@@ -30,6 +30,17 @@ Summary.prototype.init = function() {
                 $template_clone.find('a').attr('href', '#section-' + sectionCount);
                 $template_clone.removeClass('hide');
 
+                $template_clone.find('a').bind('click', function(e) {
+
+                    e.preventDefault();
+                    var self = $(this);
+                    $('html, body').animate({
+                               scrollTop:$(self.attr('href')).offset().top
+                       }, 'slow');
+                    return false;
+
+                });
+
                 that.$links.push($template_clone.find('a'));
 
                 that.$summary.append($template_clone);