Skip to content

Instantly share code, notes, and snippets.

@firatoezcan
Created November 16, 2018 20:58
Show Gist options
  • Save firatoezcan/3c5761c1c315a69510b0e152b41a0245 to your computer and use it in GitHub Desktop.
Save firatoezcan/3c5761c1c315a69510b0e152b41a0245 to your computer and use it in GitHub Desktop.
The current code of the dynamic navigation generation
document.addEventListener("DOMContentLoaded", function () {
var content = getCorrectContent()
var navigation = getCorrectNavigation()
var cssRules = [ /* Array containing strings corresponding to CSS rules */ ]
init()
function init() {
addNavigation()
addNavigationEvents()
addCSSRules(cssRules.join(""))
}
function addNavigation() {
/**
* Get the information out of the navigation
* Hydrate the templates with the required data
* concatenate the templates and prepend it to content
**/
}
function addNavigationEvents() {
// Attach EventListeners to the newly created navigation
}
function addCSSRules(css) {
// Create <style> element and append it to the head
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment