js recharge page projets filtrés au niveau des filtres
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user