mirror of
https://github.com/michivonah/website-v3.git
synced 2025-12-22 21:36:28 +01:00
implement language switch function + header improvements + accessibility optimization
This commit is contained in:
parent
caca1c825e
commit
b2eeb3b7ae
8 changed files with 54 additions and 29 deletions
|
|
@ -3,6 +3,12 @@ document.addEventListener('DOMContentLoaded', function(){
|
|||
scrollTopVisibilityUpdate();
|
||||
updateNavStyle();
|
||||
calculateAge(".age");
|
||||
|
||||
// add eventlistener to language selector
|
||||
const languageSelector = document.querySelector(".language-selector");
|
||||
languageSelector.addEventListener('change', function(){
|
||||
window.location.href = languageSelector.value + window.location.hash;
|
||||
});
|
||||
});
|
||||
|
||||
window.addEventListener('scroll', function(){
|
||||
|
|
@ -68,12 +74,12 @@ const observer = new IntersectionObserver(entries => {
|
|||
|
||||
actionObject.classList.remove('typewriter-animation');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(document.querySelector('.contact-title-wrapper'));
|
||||
observer.observe(document.querySelector('.contact-title-wrapper'));
|
||||
|
||||
// calculate age
|
||||
function calculateAge(selector){
|
||||
// calculate age
|
||||
function calculateAge(selector){
|
||||
const obj = document.querySelector(selector);
|
||||
const birthdate = obj.getAttribute("data-birthdate").split(",");
|
||||
const birth = new Date(birthdate[2], birthdate[1] - 1, birthdate[0]);
|
||||
|
|
@ -88,4 +94,4 @@ const observer = new IntersectionObserver(entries => {
|
|||
}
|
||||
|
||||
obj.textContent = age;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue