-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Iiro Järvenpää
authored and
Iiro Järvenpää
committed
Feb 23, 2024
1 parent
34aed09
commit eeaa6f2
Showing
4 changed files
with
7 additions
and
62 deletions.
There are no files selected for viewing
7 changes: 1 addition & 6 deletions
7
.../themes/custom/palvelumanuaali/components/03-organisms/site/site-header/_site-header.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
public/themes/custom/palvelumanuaali/components/05-pages/content-types/_landing-page.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |