-
Notifications
You must be signed in to change notification settings - Fork 30
/
club.js
81 lines (68 loc) · 2.44 KB
/
club.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import './sass/club.scss'
import '@fortawesome/fontawesome-free/css/all.css'
// JQuery-UI for dropdown in Teams
const $ = require('jquery')
window.$ = window.jQuery = $
require("jquery-ui-bundle")
// Navbar functionality
$(document).on('click', '#toggle', function() {
if ($('nav').hasClass('show-nav')) {
$('nav').removeClass('show-nav');
$('#toggle').removeClass('fa-times');
$('#toggle').addClass('fa-bars');
$('.mobile-grayout').removeClass("show-gray");
} else {
$('nav').addClass('show-nav');
$('#toggle').removeClass('fa-bars');
$('#toggle').addClass('fa-times');
$('.mobile-grayout').addClass("show-gray");
}
});
// Closing the navbar when a navigation link is clicked
$(document).on('click', '.nav-link', function() {
$('nav').removeClass('show-nav');
$('#toggle').removeClass('fa-times');
$('#toggle').addClass('fa-bars');
$('.mobile-grayout').removeClass("show-gray");
});
// Closing the navbar when outside of the nav is clicked
$(document).on('click', '.mobile-grayout', function() {
$('nav').removeClass('show-nav');
$('#toggle').removeClass('fa-times');
$('#toggle').addClass('fa-bars');
$('.mobile-grayout').removeClass("show-gray");
});
// FAQ Cards hide/show
let card = document.getElementsByClassName("card");
for (let i = 0; i < card.length; i++) {
let accordion = card[i].getElementsByClassName("card-header")[0];
// Click should only work on accordion-header of each card
accordion.addEventListener("click", function() {
card[i].classList.toggle("card-open");
let panel = card[i].getElementsByClassName("card-body")[0];
let fa = this.getElementsByTagName("i")[0];
// Toggle panel and plus/minus on click of header
if ($(card[i]).hasClass("card-open")) {
$(panel).slideDown(100);
} else {
$(panel).slideUp(100);
}
$(fa).toggleClass("fa-plus");
$(fa).toggleClass("fa-minus");
});
}
// Teams Dropdown
$( function() {
$("#select-team").selectmenu();
})
// Changing shown team content based on selected team
// Initially displayed section
var selectedID = "#logistics-team";
$("#select-team").on("selectmenuchange", function(event, ui) {
// Hide old selection
$(selectedID).toggleClass("show-team");
// Get the selected item
selectedID = ui.item.value;
// Show the new section
$(selectedID).toggleClass("show-team");
} );