Skip to content

Commit 784b021

Browse files
authored
Merge pull request #243 from OpenSourceOrg/fix/header-stop-movement-develop
Stop the header moving when it scrolls
2 parents 5226bf0 + 3c36769 commit 784b021

4 files changed

Lines changed: 23 additions & 37 deletions

File tree

‎themes/osi/assets/scss/_1_settings.breakpoints.scss‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ $maxPadding: 48px; // duplicates var(--wp--custom--spacing--max-padding)
4646

4747
// header dimensions
4848
$headerInnerHeight: 125px; // .header--inner fixed height; admin-bar offsets come from core's --wp-admin--admin-bar--height
49-
$headerLogoHeight: 110px; // logo cap at rest; needs a length, not none, so the shrink can animate
49+
$headerLogoWidth: 300px; // logo column width, held constant so the nav never reflows
50+
$headerLogoHeight: 110px;
51+
$headerLogoHeightSmall: 60px; // logo cap once scrolled // logo cap at rest; needs a length, not none, so the shrink can animate
5052
$mobileRowHeight: 34px; // mobile accordion row: the caret's 44px tap target centres its glyph on this
5153
$midPadding: 32px; // duplicates var(--wp--custom--spacing--mid-padding);
5254
$smallPadding: 16px; // duplicates var(--wp--custom--spacing--small-padding);

‎themes/osi/assets/scss/_6_components.header.scss‎

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
}
1010
}
1111

12-
.admin-bar {
13-
.header-main.header-main-small {
14-
top: 32px;
15-
@media only screen and (max-width: 782px) {
16-
top: 46px;
17-
}
12+
// offset in both states, or the header drops 32px out from behind the admin bar the
13+
// moment it goes small. Core stops pinning the bar below 601px, where an offset would
14+
// leave a gap once it scrolls away.
15+
.admin-bar .header-main {
16+
@media only screen and (min-width: 601px) {
17+
top: var(--wp-admin--admin-bar--height, 32px);
1818
}
1919
}
2020

@@ -54,7 +54,7 @@
5454
}
5555
img {
5656
// all logos
57-
max-width: 300px;
57+
max-width: $headerLogoWidth;
5858
max-height: $headerLogoHeight;
5959
height: auto;
6060
width: auto;
@@ -77,7 +77,7 @@
7777
.header--blog-name {
7878
a {
7979
img {
80-
max-height: 60px;
80+
max-height: $headerLogoHeightSmall;
8181
}
8282
}
8383
}
@@ -127,6 +127,10 @@
127127
position: relative;
128128
}
129129
.header--blog-name {
130+
// hold the column at full-logo width: letting it shrink with the logo hands the
131+
// nav that width and the menu reflows from two rows to one
132+
flex-shrink: 0;
133+
width: $headerLogoWidth;
130134
.hide-mobile {
131135
display: inline-block;
132136
}
@@ -179,17 +183,6 @@
179183
// source-order tie and drop the open panel's bottom border
180184
.header-main-small {
181185
@include header-white-veil;
182-
.nav-main {
183-
height: auto;
184-
top: 0;
185-
// transition: all .2s;
186-
margin-top: 0;
187-
.nav-main--menu>.menu-item>a {
188-
padding-top: 0.6em;
189-
padding-bottom: 0.5em;
190-
transition: all .3s;
191-
}
192-
}
193186
}
194187
}
195188

‎themes/osi/style.css‎

Lines changed: 7 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)