lien anchor reste sous header au click
This commit is contained in:
@@ -135,15 +135,23 @@ jQuery(function($) {
|
|||||||
|
|
||||||
|
|
||||||
// /////////////////
|
// /////////////////
|
||||||
//// ancre dans texte
|
//// ancre dans texte au click parragraphe correspondant arrive en dessous du header
|
||||||
// document.querySelector('.paragraph--view-mode--textes-toc').click( function() {
|
|
||||||
// var page = this.attr('href');
|
|
||||||
// var speed = 750; // gérer la vitesse de défliement
|
(function($, window) {
|
||||||
|
var adjustAnchor = function() {
|
||||||
// // Ici on retranche la hauteur du bandeau (201px dans ta feuille de styles)
|
var $anchor = $('.block-entity-fieldnodefield-textes'),
|
||||||
// document.querySelector('html, body').animate( { scrollTop: page.offset().top - 500 }, speed );
|
fixedElementHeight = 350;
|
||||||
// return false;
|
if ($anchor.length > 0) {
|
||||||
// });
|
$('html, body').stop().animate({scrollTop: $anchor.offset().top - fixedElementHeight}, 250);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$(window).on('hashchange load', function() {
|
||||||
|
adjustAnchor();
|
||||||
|
});
|
||||||
|
|
||||||
|
})(jQuery, window);
|
||||||
|
|
||||||
|
|
||||||
// ///////////////////////////////
|
// ///////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user