From 1cd1d30cf079f0094e6ce8c63d3657341b816af7 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Mar 2026 04:23:01 +0000 Subject: [PATCH 1/2] feat: add sticky day header when scrolling through posts When the user scrolls down, a floating date label appears at the top of the page showing which day's posts are currently visible. It updates automatically as the user scrolls between day groups, and disappears when scrolled back to the top. Fixes #47 https://claude.ai/code/session_012xh9iGf2pSFsWi5kUURDCw --- assets/js/main.js | 22 ++++++++++++++++++++++ index.php | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/assets/js/main.js b/assets/js/main.js index e77febd..07f10dd 100755 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -827,6 +827,27 @@ $(document).ready(function () { } }); + // Met à jour l'en-tête de jour sticky en fonction du scroll + function updateStickyDayHeader() { + var scrollTop = $(window).scrollTop(); + var $header = $('#sticky-day-header'); + var activeLabel = null; + + $('.day-group').each(function () { + var sepTop = $(this).find('.day-separator').offset().top; + if (sepTop < scrollTop + 10) { + activeLabel = $(this).find('.day-separator span').text(); + } + }); + + if (activeLabel) { + $header.find('span').text(activeLabel); + $header.addClass('visible'); + } else { + $header.removeClass('visible'); + } + } + // Bouton retour en haut de la page $(window).scroll(function () { if ($(this).scrollTop() > 300) { @@ -834,6 +855,7 @@ $(document).ready(function () { } else { $('#btn-back-to-top').hide(); } + updateStickyDayHeader(); }); $('#btn-back-to-top').click(function () { diff --git a/index.php b/index.php index 4f18da2..ed93eb3 100755 --- a/index.php +++ b/index.php @@ -425,6 +425,40 @@ function taille_format($taille) display: block; } + /* En-tête de jour sticky */ + #sticky-day-header { + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 500; + display: flex; + justify-content: center; + pointer-events: none; + opacity: 0; + transition: opacity .2s; + } + + #sticky-day-header.visible { + opacity: 1; + } + + #sticky-day-header span { + background: rgba(255, 255, 255, 0.92); + backdrop-filter: blur(4px); + -webkit-backdrop-filter: blur(4px); + border: 1px solid #dee2e6; + border-top: none; + border-radius: 0 0 10px 10px; + padding: 2px 14px 4px; + font-size: .72rem; + font-weight: 600; + color: #6c757d; + text-transform: uppercase; + letter-spacing: .6px; + box-shadow: 0 2px 6px rgba(0, 0, 0, .08); + } + /* Config modal */ #box-config { position: fixed; @@ -647,6 +681,7 @@ function taille_format($taille) +