This commit is contained in:
2018-04-24 20:41:34 -05:00
commit 0348bb3c42
43 changed files with 5169 additions and 0 deletions

4
dev/js/main.js Normal file
View File

@ -0,0 +1,4 @@
function isTouchDevice() {
return 'ontouchstart' in window || navigator.maxTouchPoints;
}
if(isTouchDevice()){ $('body').addClass('is-touch'); }

23
dev/js/main/menu.js Normal file
View File

@ -0,0 +1,23 @@
var body = document.querySelector('body');
var menuList = document.querySelector('#menu-list');
var navToggles = document.querySelectorAll('[aria-controls="menu-list"]');
navToggles.forEach(function(toggle){
toggle.addEventListener('click', function(event){
var expanded = menuList.getAttribute('aria-expanded') === 'true' || false;
menuList.setAttribute('aria-expanded', !expanded);
body.setAttribute('data-menu', !expanded);
event.stopPropagation();
});
});
body.addEventListener('click', function(event){
var isMenu = $(event.target).closest('#menu-list').length > 0;
if(isMenu){ return false; }
var expanded = menuList.getAttribute('aria-expanded') === 'true' || false;
if(expanded){
menuList.setAttribute('aria-expanded', !expanded);
body.setAttribute('data-menu', !expanded);
}
});

23
dev/js/main/scrolling.js Normal file
View File

@ -0,0 +1,23 @@
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll('[href^="#"]').forEach(function(link){
link.addEventListener('click', function(event){
var target = document.querySelector(this.getAttribute('href'));
if(target !== null){
target.scrollIntoView({
behavior: 'smooth'
});
window.setTimeout(function(){
var index = target.getAttribute('tabindex');
target.setAttribute('tabindex', -1);
target.focus();
target.setAttribute('tabindex', index);
history.pushState({},null,"#" + target.getAttribute('id'));
}, 800);
event.preventDefault();
}
});
});
});