Bike!Bike! Website!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.1 KiB

(function() {
var body = document.querySelector('body');
var primaryContent = document.getElementById('primary-content');
var eventDlg = document.getElementById('event-dlg');
forEachElement('.event-detail-link', function(link) {
var eventDetails = link.parentElement.querySelector('.event-details');
var moreDetails = eventDlg.querySelector('.more-details');
link.addEventListener('click', function(event) {
event.preventDefault();
eventDlg.querySelector('.event-details').innerHTML = eventDetails.innerHTML;
var href = eventDetails.getAttribute('data-href');
if (href) {
moreDetails.setAttribute('href', href);
moreDetails.classList.remove('hidden');
} else {
moreDetails.classList.add('hidden');
}
window.openOverlay(eventDlg, primaryContent, body);
var closeDlg = function(event) {
event.preventDefault();
window.closeOverlay(eventDlg, primaryContent, body);
};
eventDlg.querySelector('.close-btn').onclick = closeDlg;
document.getElementById('overlay').onclick = closeDlg;
});
});
})();