-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLayout.js
More file actions
39 lines (30 loc) · 845 Bytes
/
Layout.js
File metadata and controls
39 lines (30 loc) · 845 Bytes
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
'use strict';
class Layout {
constructor (root, style) {
this.root = root;
this.style = style;
this.elements = null;
this.header = null;
this.main = null;
this.footer;
}
generate() {
//generar elementos del DOM
this.elements = `
<header id="site-header"></header>
<main id="site-main"></main>
<footer id="site-footer"></footer>`;
this.render();
this.getContainers();
}
render() {
//añadir los elementos al DOM
this.root.innerHTML = this.elements;
}
getContainers() {
//get main, header, footer del DOM
this.header = document.querySelector('#site-header');
this.main = document.querySelector('#site-main');
this.footer = document.querySelector('#site-footer');
}
}