Skip to content

Commit 10de6bc

Browse files
Added starter script.js
1 parent 23f0386 commit 10de6bc

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
///////////////////////////////////////////////////////////
2+
// Fixing flexbox gap property missing in some Safari versions
3+
function checkFlexGap() {
4+
var flex = document.createElement("div");
5+
flex.style.display = "flex";
6+
flex.style.flexDirection = "column";
7+
flex.style.rowGap = "1px";
8+
9+
flex.appendChild(document.createElement("div"));
10+
flex.appendChild(document.createElement("div"));
11+
12+
document.body.appendChild(flex);
13+
var isSupported = flex.scrollHeight === 1;
14+
flex.parentNode.removeChild(flex);
15+
console.log(isSupported);
16+
17+
if (!isSupported) document.body.classList.add("no-flexbox-gap");
18+
}
19+
checkFlexGap();
20+
21+
// https://unpkg.com/[email protected]/dist/smoothscroll.min.js
22+
23+
/*
24+
.no-flexbox-gap .main-nav-list li:not(:last-child) {
25+
margin-right: 4.8rem;
26+
}
27+
28+
.no-flexbox-gap .list-item:not(:last-child) {
29+
margin-bottom: 1.6rem;
30+
}
31+
32+
.no-flexbox-gap .list-icon:not(:last-child) {
33+
margin-right: 1.6rem;
34+
}
35+
36+
.no-flexbox-gap .delivered-faces {
37+
margin-right: 1.6rem;
38+
}
39+
40+
.no-flexbox-gap .meal-attribute:not(:last-child) {
41+
margin-bottom: 2rem;
42+
}
43+
44+
.no-flexbox-gap .meal-icon {
45+
margin-right: 1.6rem;
46+
}
47+
48+
.no-flexbox-gap .footer-row div:not(:last-child) {
49+
margin-right: 6.4rem;
50+
}
51+
52+
.no-flexbox-gap .social-links li:not(:last-child) {
53+
margin-right: 2.4rem;
54+
}
55+
56+
.no-flexbox-gap .footer-nav li:not(:last-child) {
57+
margin-bottom: 2.4rem;
58+
}
59+
60+
@media (max-width: 75em) {
61+
.no-flexbox-gap .main-nav-list li:not(:last-child) {
62+
margin-right: 3.2rem;
63+
}
64+
}
65+
66+
@media (max-width: 59em) {
67+
.no-flexbox-gap .main-nav-list li:not(:last-child) {
68+
margin-right: 0;
69+
margin-bottom: 4.8rem;
70+
}
71+
}
72+
*/

0 commit comments

Comments
 (0)