js recharge page projets filtrés au niveau des filtres

This commit is contained in:
2025-05-16 11:50:45 +02:00
parent 17fd62bd51
commit 5c941c4654
5 changed files with 31 additions and 2 deletions
+23
View File
@@ -279,6 +279,29 @@ document.querySelectorAll('a[href^="http"]').forEach(link => {
/////////////// end ouverture liens externes vers nouvel onglet //////////////////
document.addEventListener("DOMContentLoaded", function () {
const form = document.querySelector(".views-exposed-form");
// console.log(form);
if (form) {
form.setAttribute("action", form.action.split("#")[0] + "#filtres");
}
if (window.location.hash === "#filtres") {
const target = document.getElementById("filtres");
if (target) {
// target.scrollIntoView({ behavior: "smooth", block: "start" });
const offset = 300;
const top = target.getBoundingClientRect().top + window.pageYOffset - offset;
window.scrollTo({
top: top,
behavior: "smooth"
});
}
}
});
})(jQuery, window);