From: Jérémy Fabre Date: Tue, 8 Nov 2016 10:59:25 +0000 (+0100) Subject: Smooth scroll on summary links X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=caa4ec3b6f28bd399ce16f420f144db028bfc446;p=mezzo.git Smooth scroll on summary links --- diff --git a/app/static/src/js/modules/summary.js b/app/static/src/js/modules/summary.js index 9db79ef8..ae0a8b5a 100644 --- a/app/static/src/js/modules/summary.js +++ b/app/static/src/js/modules/summary.js @@ -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);