Fixed header shadow on older Safari

This commit is contained in:
squidfunk 2020-02-15 23:24:29 +01:00
parent a6b22a4461
commit a539eab0b5
2 changed files with 5 additions and 1 deletions

View File

@ -52,7 +52,10 @@ export function watchHeader(
el: HTMLElement el: HTMLElement
): Observable<Header> { ): Observable<Header> {
const styles = getComputedStyle(el) const styles = getComputedStyle(el)
const sticky = styles.position === "sticky" const sticky = [
"sticky", /* Modern browsers */
"-webkit-sticky" /* Old Safari */
].includes(styles.position)
return of({ return of({
sticky, sticky,
height: sticky ? el.offsetHeight : 0 height: sticky ? el.offsetHeight : 0

View File

@ -66,6 +66,7 @@ body {
display: flex; display: flex;
position: relative; position: relative;
flex-direction: column; flex-direction: column;
width: 100%;
min-height: 100%; min-height: 100%;
// Hack: reset font-size to 10px, so the spacing for all inline elements is // Hack: reset font-size to 10px, so the spacing for all inline elements is
// correct again. Otherwise the spacing would be based on 20px. // correct again. Otherwise the spacing would be based on 20px.