let root = document.documentElement // Used for css variables let selectedSports = [] $(".sport").on("click", function() { $(this).toggleClass("selected") let sportName = $(this).children()[1].innerHTML // 2nd element, which is the sport name let index = selectedSports.indexOf(sportName) if (index > -1 ) { // If element is found in array selectedSports.splice(index, 1) // Remove sport at index } else { selectedSports.push(sportName) // Add sport to array } $(this).trigger("selected", [selectedSports.includes(sportName), selectedSports]) // Trigger event showFeeds() }) function getCSSVariable(name) { return getComputedStyle(root).getPropertyValue(name) } function showFeeds() { if ($(window).width() < 1280) { if (selectedSports.length === 0) { $(".leftcol").show() $(".centercol").hide() } else { $(".leftcol").hide() $(".centercol").show() } } else { $(".leftcol").show() $(".centercol").show() } } $(window).on("resize", function(){ showFeeds() }); $(window).on("load", function() { showFeeds() }) function tweetCell(tweet) { var cell = document.createElement("div"); cell.innerHTML = `