Skip to content

Commit 817da84

Browse files
authored
Merge pull request #387 from awesomemotive/issue/382-Sticky-Header-Row-Option-Applies-to-Both-Rows
Header Builder: disconnect the bottom row from the main row when the main row is selected to be sticky
2 parents 4afc622 + 11382bf commit 817da84

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

assets/js/src/custom.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,17 @@ botiga.stickyHeader = {
780780
let topVal = 0,
781781
convertToPositive = false;
782782

783+
// Remove any existing sticky visibility classes
784+
above_header_row.classList.remove( 'bhfb-sticky-hidden' );
785+
main_header_row.classList.remove( 'bhfb-sticky-hidden' );
786+
below_header_row.classList.remove( 'bhfb-sticky-hidden' );
787+
783788
if( bhfb.classList.contains( 'sticky-row-main-header-row' ) ) {
789+
// Hide bottom row when main row is sticky
790+
if( ! below_header_row.classList.contains( 'bt-d-none' ) ) {
791+
below_header_row.classList.add( 'bhfb-sticky-hidden' );
792+
}
793+
784794
if( ! above_header_row.classList.contains( 'bt-d-none' ) ) {
785795
topVal = above_header_row.clientHeight;
786796

assets/sass/bhfb.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@
3434
transition: ease background-color 300ms, ease border-bottom-color 300ms, ease height 300ms;
3535
}
3636

37+
// Hide rows when sticky header is active and they shouldn't be visible
38+
.sticky-header-active .bhfb-sticky-hidden {
39+
display: none !important;
40+
}
41+
42+
// Hide bottom row when main row is sticky
43+
.sticky-header-active .sticky-row-main-header-row .bhfb-below_header_row {
44+
display: none !important;
45+
}
46+
3747
.bhfb-main_header_row {
3848
min-height: 100px;
3949
}

0 commit comments

Comments
 (0)