mirror of
https://github.com/rickbarrette/redmine_qbo_calendar.git
synced 2026-11-17 21:50:37 -05:00
Today button lines up today's day number at the top
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e5ba9faae3
commit
f8701885c5
1 file changed
+5
-1
@@ -26,9 +26,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
window.scrollToToday = function() {
|
window.scrollToToday = function() {
|
||||||
|
// Line up today's day number near the top of the window. Centering the whole cell hid the number
|
||||||
|
// above the window when the day is busy (tall cell).
|
||||||
const todayElement = document.getElementById('today');
|
const todayElement = document.getElementById('today');
|
||||||
if (todayElement) {
|
if (todayElement) {
|
||||||
todayElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
const target = todayElement.querySelector('.day-num') || todayElement;
|
||||||
|
const top = target.getBoundingClientRect().top + window.scrollY - 10;
|
||||||
|
window.scrollTo({ top: Math.max(top, 0), behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user