design actus

This commit is contained in:
2024-08-07 19:17:51 +02:00
parent 869db4c869
commit 1dc1b04302
6 changed files with 191 additions and 149 deletions
+45 -45
View File
@@ -135,13 +135,13 @@ jQuery(document).ready(function($){
$(document).ready(function(){
$('.view-id-actus.view-display-id-block_1 ').slick({
// slidesToShow: 1,
// slidesToScroll: 1,
slidesToShow: 1,
slidesToScroll: 1,
// dots: true,
arrows: true,
// centerMode: true,
draggable: true,
// centerPadding: '100px',
centerPadding: '100px',
responsive: [
{
breakpoint: 810,
@@ -188,53 +188,53 @@ jQuery(document).ready(function($){
// /////////////////
//// ancre dans texte au click parragraphe correspondant arrive en dessous du header
function adjustAnchor() {
var $anchor = $(window.location.hash); // Select the anchor element based on the hash in the URL
var fixedElementHeight = $('.block-region-first').outerHeight(); // Get the height of the sticky element
function adjustAnchor() {
var $anchor = $(window.location.hash); // Select the anchor element based on the hash in the URL
var fixedElementHeight = $('.block-region-first').outerHeight(); // Get the height of the sticky element
if ($anchor.length > 0) {
$('html, body').stop().animate({
scrollTop: $anchor.offset().top - fixedElementHeight // Adjust the scroll position to account for the sticky element height
}, 0);
}
}
// Call the function on page load if there's a hash
if (window.location.hash) {
adjustAnchor();
}
// Adjust the anchor on hash change
$(window).on('hashchange', function() {
adjustAnchor();
});
//////////////////////////////////////////
// menu ancre paragraphe quand actif
jQuery(function($) {
// Function to set the active class based on the current path
function setActiveLink() {
var path = window.location.href;
console.log(path);
$(".layout__region--first .block-region-first li a").each(function() {
if (this.href === path) {
$(this).closest('a').addClass('active');
}
});
if ($anchor.length > 0) {
$('html, body').stop().animate({
scrollTop: $anchor.offset().top - fixedElementHeight // Adjust the scroll position to account for the sticky element height
}, 0);
}
}
// Initially set the active link based on the current URL
setActiveLink();
// Call the function on page load if there's a hash
if (window.location.hash) {
adjustAnchor();
}
// Update the active link on click
$(".layout__region--first .block-region-first li a").on('click', function() {
$(".layout__region--first .block-region-first li a").removeClass('active');
$(this).addClass('active');
// Adjust the anchor on hash change
$(window).on('hashchange', function() {
adjustAnchor();
});
//////////////////////////////////////////
// menu ancre paragraphe quand actif
jQuery(function($) {
// Function to set the active class based on the current path
function setActiveLink() {
var path = window.location.href;
console.log(path);
$(".layout__region--first .block-region-first li a").each(function() {
if (this.href === path) {
$(this).closest('a').addClass('active');
}
});
}
// Initially set the active link based on the current URL
setActiveLink();
// Update the active link on click
$(".layout__region--first .block-region-first li a").on('click', function() {
$(".layout__region--first .block-region-first li a").removeClass('active');
$(this).addClass('active');
});
});
});
})(jQuery, window);