Skip to content

Commit

Permalink
TP-1268 remove fixed header
Browse files Browse the repository at this point in the history
  • Loading branch information
Iiro Järvenpää authored and Iiro Järvenpää committed Feb 23, 2024
1 parent 34aed09 commit eeaa6f2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@

.header {
transition: transform 0.5s;

@media only screen and (max-width: $large) {
transform: unset !important;
}

@include large {
position: fixed;
z-index: 200;
width: 100%;
margin: auto;
}

&--hidden {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
.landing-page {
.main {
@include xl {
margin-top: 182px;
}

}
.region-postcontent,
.region-content {
grid-template-columns: 12fr;
Expand Down
11 changes: 5 additions & 6 deletions public/themes/custom/palvelumanuaali/dist/css/style.css

Large diffs are not rendered by default.

45 changes: 1 addition & 44 deletions public/themes/custom/palvelumanuaali/js/header.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,16 @@
(function ($, Drupal, window) {
'use strict';
// Example of Drupal behavior loaded.
Drupal.behaviors.headerJs = {
attach: function (context, settings) {
if (typeof context['location'] !== 'undefined') { // Only fire on document load.
let nav = $("#page-header");
let lastScrollY = 0;
let header = document.getElementById("page-header");
if (header == null) {
return;
}
let height = header.offsetHeight;
addEventListener('scroll', function () {
let currentScrollY = $(this).scrollTop();
if ($(window).width() > 920 ) {
if (lastScrollY < currentScrollY && currentScrollY > 50) {
nav.addClass("header--hidden");
header.style.transform = "translateY(-" + height + "px)"
} else {
nav.removeClass("header--hidden");
header.style.transform = "translateY(0px)"
}
}
lastScrollY = currentScrollY;
});
}
}
};

Drupal.behaviors.searchCollapse = {
attach: function (context, settings) {
let filterButton = $(".additional-filters");
if (filterButton.length == 0) {
return
}
}
filterButton[0].addEventListener('click', (e) => {
$(".header__primary").toggleClass("filters-open");
});

}
};

Drupal.behaviors.headerHeight = {
attach: function (context, settings) {
let header = document.querySelector('#page-header');
if (header == null) {
return;
}
let height = header.offsetHeight;
if ($(window).width() > 920 ) {
let content = document.getElementsByClassName("main--with-sidebar");
content[0].style.marginTop = height +'px';
}
}
};


})(jQuery, Drupal, this);

0 comments on commit eeaa6f2

Please sign in to comment.