Permalink
Browse files

feat(navbar): enable default behavior of nav link on wide screens

  • Loading branch information...
lara-aigmueller committed Aug 17, 2017
1 parent 0c1f671 commit fab7fda196b16588224038edadcd0fd736514996
Showing with 28 additions and 4 deletions.
  1. +1 −2 src/main.js
  2. +19 −2 src/navbar/navbar.js
  3. +8 −0 src/navbar/navbar.scss
View
@@ -1,8 +1,7 @@
require('./js-common-components/toggler');
require('./js-common-components/closest');
require('./expandable/expandable');
require('./tabs/tabs');
require('./slider/slider');
require('./table/table');
require('./navbar/navbar');
require('./expandable/expandable');
View
@@ -80,7 +80,7 @@ const handleKeydown = (ev) => {
return false;
};
const initData = () => {
const initSearch = () => {
$('.js-search:not([action=""])').forEach(el => {
const form = el.parentNode;
const ul = form.appendChild(document.createElement('ul'));
@@ -111,4 +111,21 @@ const initData = () => {
});
};
initData();
const getSize = () => {
const size = window.getComputedStyle(document.body, ':after').getPropertyValue('content');
return size.replace(/[\W]/g, '');
};
const init = () => {
$('.expandable__trigger.nav__link').forEach(el => {
el.addEventListener('click', (ev) => {
const size = getSize();
if (size === 'widescreen') {
ev.stopImmediatePropagation();
}
});
});
};
initSearch();
init();
View
@@ -377,3 +377,11 @@
outline: none;
background-color: $gray-640;
}
@media (min-width: $nav-breakpoint) {
body:after {
content: "widescreen";
display: none;
}
}

0 comments on commit fab7fda

Please sign in to comment.