Socialify

Folder ..

Viewing _pm-sticky-header.scss
62 lines (53 loc) • 1.1 KB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * sticky header and container for sections
 */

$sticky-title-height: 10rem !default;
.sticky-title {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.1);
  padding: .5em .75em;
  background: inherit;
  z-index: 11;
}
.sticky-title--onTop {
  box-shadow: none;
}
.sticky-title--noPadding {
  padding: 0;
}

.container-section-sticky {
  padding: 3em 2em 0 2em;
  max-width: 120ch; // avoid too long lines
  margin-left: auto;
  margin-right: auto;
}

.container-section-sticky.pt0 { // 😓
  padding-top: 0;
}

.container-section-sticky--fullwidth {
  max-width: none;
}

.container-section-sticky-section {
  margin-bottom: 8rem;
}


/* trick for fixing anchor links */
.header-height-anchor {
  position: absolute;
  top: -#{$sticky-title-height};
}

// not sticky on mobile
@include respond-to($breakpoint-small) {
  .sticky-title:not(.onmobile-remain-sticky) {
    position: static;
    box-shadow: none;
  }
  .container-section-sticky-section {
    margin-bottom: 8rem;
  }
  .header-height-anchor {
    position: static;
    top: 0;
  }
}