Fix javascript scroll_to
This commit is contained in:
parent
bc41412b6b
commit
c09a92a109
1 changed files with 11 additions and 4 deletions
|
@ -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;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue