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
File diff suppressed because one or more lines are too long
+3
View File
@@ -3978,6 +3978,9 @@ svg.ext {
.path-projets .region-content #block-contenudelapageprincipale .layout--onecol .block-region-content .block-views-blockprojets-block-1 .view-projets {
margin: auto;
}
.path-projets .region-content #block-contenudelapageprincipale .layout--onecol .block-region-content .block-views-blockprojets-block-1 .view-projets #filtres {
scroll-margin-top: 10rem;
}
.path-projets .region-content #block-contenudelapageprincipale .layout--onecol .block-region-content .block-views-blockprojets-block-1 .view-projets .view-filters {
margin-top: 4rem;
display: flex;
+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);
@@ -121,6 +121,9 @@
margin: auto;
//filtres
#filtres {
scroll-margin-top: 10rem;
}
.view-filters{
margin-top: 4rem;
display: flex;
@@ -52,7 +52,7 @@
</div>
{% endif %}
{% if exposed %}
<div class="view-filters">
<div class="view-filters" id='filtres'>
{{ exposed }}
</div>
{% endif %}