-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
114 lines (93 loc) · 2.85 KB
/
script.js
File metadata and controls
114 lines (93 loc) · 2.85 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
let container = document.querySelector('.item-container');
let item = document.querySelector('.item');
function setActiveButton(button) {
const buttons = button.parentElement.getElementsByClassName('button');
for (let btn of buttons) {
btn.classList.remove('active-button');
}
button.classList.add('active-button');
}
// Flex direction of items inside the container
function containerRow(button) {
container.style.flexDirection = 'row';
setActiveButton(button);
}
function containerColumn(button) {
container.style.flexDirection = 'column';
setActiveButton(button);
}
function containerRowReverse(button) {
container.style.flexDirection = 'row-reverse';
setActiveButton(button);
}
function containerColumnReverse(button) {
container.style.flexDirection = 'column-reverse';
setActiveButton(button);
}
// Align items button functions
function containerFlexStart(button) {
container.style.alignItems = 'flex-start';
setActiveButton(button);
}
function containerFlexEnd(button) {
container.style.alignItems = 'flex-end';
setActiveButton(button);
}
function containerCenter(button) {
container.style.alignItems = 'center';
setActiveButton(button);
}
function containerStretch(button) {
container.style.alignItems = 'stretch';
setActiveButton(button);
}
// Justify content button functions
function containerJustifyFlexStart(button) {
container.style.justifyContent = 'flex-start';
setActiveButton(button);
}
function containerJustifyFlexEnd(button) {
container.style.justifyContent = 'flex-end';
setActiveButton(button);
}
function containerJustifyCenter(button) {
container.style.justifyContent = 'center';
setActiveButton(button);
}
function containerJustifySpaceBetween(button) {
container.style.justifyContent = 'space-between';
setActiveButton(button);
}
function containerJustifySpaceAround(button) {
container.style.justifyContent = 'space-around';
setActiveButton(button);
}
function containerJustifySpaceEvenly(button) {
container.style.justifyContent = 'space-evenly';
setActiveButton(button);
}
// Align content button functions
function containerAlignFlexStart(button) {
container.style.alignContent = 'flex-start';
setActiveButton(button);
}
function containerAlignFlexEnd(button) {
container.style.alignContent = 'flex-end';
setActiveButton(button);
}
function containerAlignCenter(button) {
container.style.alignContent = 'center';
setActiveButton(button);
}
function containerAlignStretch(button) {
container.style.alignContent = 'stretch';
setActiveButton(button);
}
function containerAlignSpaceBetween(button) {
container.style.alignContent = 'space-between';
setActiveButton(button);
}
function containerAlignSpaceAround(button) {
container.style.alignContent = 'space-around';
setActiveButton(button);
}