2018-08-27 14:37:06 +00:00
|
|
|
import "bootstrap";
|
2018-08-31 09:17:26 +00:00
|
|
|
|
2018-08-31 10:55:03 +00:00
|
|
|
import { triggerModalEvent } from "../components/modal.js";
|
|
|
|
|
|
|
|
triggerModalEvent();
|
|
|
|
|
2018-09-01 16:36:46 +00:00
|
|
|
const links = document.querySelector('links');
|
|
|
|
const linksList = document.querySelectorAll('.links div');
|
2018-08-31 10:55:03 +00:00
|
|
|
|
2018-09-01 16:36:46 +00:00
|
|
|
const getSiblings = function (elem) {
|
|
|
|
const siblings = [];
|
|
|
|
let sibling = elem.parentNode.firstChild;
|
|
|
|
const skipMe = elem;
|
|
|
|
for ( ; sibling; sibling = sibling.nextSibling )
|
|
|
|
if ( sibling.nodeType == 1 && sibling != elem )
|
|
|
|
siblings.push( sibling );
|
|
|
|
return siblings;
|
|
|
|
}
|
|
|
|
|
|
|
|
linksList.forEach(link => {
|
|
|
|
link.addEventListener('click', event => {
|
|
|
|
// event.preventDefault()
|
|
|
|
link.classList.add('active')
|
|
|
|
const siblings = getSiblings(link)
|
|
|
|
siblings.forEach(sibling => {
|
|
|
|
sibling.classList.remove('active');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|