This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Reset CSS */ | |
* { | |
box-sizing: border-box; | |
margin: 0; | |
padding: 0; | |
} | |
/* Typography */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Utility Functions */ | |
const elementHasClass = function(element, theClass) { | |
return element.className.includes(theClass); | |
}; | |
const elementAddsClass = function (element, theClass) { | |
var classArray = element.className.split(' '); | |
var newClassArray = classArray.concat(theClass); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.dropdown { | |
font-family: Arial, sans-serif; | |
font-size: 16px; | |
display: inline-block; | |
position: relative; | |
} | |
.dropdown-btn { | |
font-size: 14px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<title>A Normal Dropdown</title> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var toggleTheList = function(event) { | |
var theBtn = event.target; | |
var theList = theBtn.nextElementSibling; | |
var theListIsHidden = theList.className.includes('hidden'); | |
if (theListIsHidden) | |
theList.className = 'dropdown-list shown'; | |
else | |
theList.className = 'dropdown-list hidden'; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.dropdown { | |
font-family: Arial, sans-serif; | |
font-size: 16px; | |
display: inline-block; | |
position: relative; | |
} | |
.dropdown-btn { | |
font-size: 14px; |