diff --git a/src/jsMain/kotlin/de/kif/frontend/views/calendar/Calendar.kt b/src/jsMain/kotlin/de/kif/frontend/views/calendar/Calendar.kt index 3a6031e..01e0a22 100644 --- a/src/jsMain/kotlin/de/kif/frontend/views/calendar/Calendar.kt +++ b/src/jsMain/kotlin/de/kif/frontend/views/calendar/Calendar.kt @@ -89,22 +89,26 @@ class Calendar(calendar: HTMLElement) : View(calendar) { val x = html.offsetTop - htmlBody.scrollTop if (x > 0) { val bodyScroll = min(x, verticalScroll) - verticalScroll -= bodyScroll + verticalScroll = 0.0 htmlBody.scrollBy(ScrollToOptions(0.0, bodyScroll, ScrollBehavior.INSTANT)) } else { if (calendarTable.scrollTop + calendarTable.clientHeight + 5 >= calendarTable.scrollHeight) { htmlBody.scrollBy(ScrollToOptions(0.0, verticalScroll, ScrollBehavior.INSTANT)) + } else if (x < 0) { + htmlBody.scrollBy(ScrollToOptions(0.0, x, ScrollBehavior.INSTANT)) } } } else if (verticalScroll < 0) { val x = html.offsetTop - htmlBody.scrollTop if (x < 0) { val bodyScroll = max(x, verticalScroll) - verticalScroll -= bodyScroll + verticalScroll = 0.0 htmlBody.scrollBy(ScrollToOptions(0.0, bodyScroll, ScrollBehavior.INSTANT)) } else { if (calendarTable.scrollTop == 0.0) { htmlBody.scrollBy(ScrollToOptions(0.0, verticalScroll, ScrollBehavior.INSTANT)) + } else if (x > 0) { + htmlBody.scrollBy(ScrollToOptions(0.0, x, ScrollBehavior.INSTANT)) } } } diff --git a/src/jsMain/resources/style/components/_calendar.scss b/src/jsMain/resources/style/components/_calendar.scss index 70728d0..ce91207 100644 --- a/src/jsMain/resources/style/components/_calendar.scss +++ b/src/jsMain/resources/style/components/_calendar.scss @@ -369,7 +369,12 @@ .calendar-cell:first-child { text-align: center; - width: 6rem; + width: 4rem; + left: 0; + position: sticky; + z-index: 2; + background-color: var(--background-secondary-color); + border-right: solid 1px var(--table-border-color); } .calendar-cell:not(:first-child) { @@ -387,6 +392,10 @@ position: absolute; } } + + .calendar-cell:nth-child(1)::before , .calendar-cell:nth-child(2)::before{ + border-left: none; + } } .calendar-body { @@ -421,12 +430,20 @@ } .calendar-cell:first-child { - width: 6rem; + width: 4rem; left: 0; text-align: center; + position: sticky; + z-index: 2; + background-color: var(--background-secondary-color); + border-right: solid 1px var(--table-border-color); + + &:not(:empty) { + z-index: 3; + } } - .calendar-cell:first-child::before { + .calendar-cell:nth-child(1)::before , .calendar-cell:nth-child(2)::before{ border-left: none; }