Fix javascript scroll_to

This commit is contained in:
Xavier J 2016-02-09 11:16:19 +01:00
parent bc41412b6b
commit c09a92a109

View file

@ -28,11 +28,18 @@
//= require turf
//= require franceconnect
$(document).ready(function() {
$('.js-scrollTo').on('click', function() { // Au clic sur un élément
$(document).on('page:load', scroll_to);
$(document).ready(scroll_to);
function scroll_to() {
$('.js-scrollTo').on('click', function () { // Au clic sur un élément
var page = $(this).attr('cible'); // Page cible
var speed = 600; // Durée de l'animation (en ms)
$('html, body').animate( { scrollTop: $(page).offset().top-100 }, speed ); // Go
$('html, body').animate({scrollTop: $(page).offset().top - 100}, speed); // Go
return false;
});
});
}