Add a sticky issue header to issue page (#42684).

Patch by Mizuki ISHIKAWA (user:ishikawa999).


git-svn-id: https://svn.redmine.org/redmine/trunk@23752 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2025-05-10 01:00:13 +00:00
parent b408b59d99
commit 1b9698df2c
5 changed files with 105 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
import { Controller } from "@hotwired/stimulus";
export default class extends Controller {
static targets = ["original", "stickyHeader"];
connect() {
if (!this.originalTarget || !this.stickyHeaderTarget) return;
this.observer = new IntersectionObserver(
([entry]) => {
this.stickyHeaderTarget.classList.toggle("is-visible", !entry.isIntersecting);
},
{ threshold: 0 }
);
this.observer.observe(this.originalTarget);
}
disconnect() {
this.observer?.disconnect();
}
}