sans smooth scroll pour le premier retour des ancres sans va-et-vient

This commit is contained in:
chankalan 2021-01-28 10:45:02 +01:00
parent ade00e73f3
commit fd98f66477
1 changed files with 20 additions and 20 deletions

View File

@ -55,26 +55,26 @@ $(function() {
});
// smooth scroll
$('a[href^="#"], .js-scrollTo').on('click', function(e) {
if($(this).hasClass('js-noscroll')) {
return;
}
var hash = this.hash;
var $target = $(hash);
var offset = $target.offset();
if(!offset) {
$target = $('a[name='+hash.replace(/#/,'')+']');
offset = $target.offset();
}
if(offset) {
e.preventDefault();
var newPos = offset.top - 10;
$('html, body').stop().animate(
{'scrollTop': newPos}, 750, 'swing', function() {
window.location.hash = hash;
});
}
});
// $('a[href^="#"], .js-scrollTo').on('click', function(e) {
// if($(this).hasClass('js-noscroll')) {
// return;
// }
// var hash = this.hash;
// var $target = $(hash);
// var offset = $target.offset();
// if(!offset) {
// $target = $('a[name='+hash.replace(/#/,'')+']');
// offset = $target.offset();
// }
// if(offset) {
// e.preventDefault();
// var newPos = offset.top - 10;
// $('html, body').stop().animate(
// {'scrollTop': newPos}, 750, 'swing', function() {
// window.location.hash = hash;
// });
// }
// });
// champ de recherche dans le menu
$('.loupe > a').on('click', function(){