Skip to content

Commit 6dbfd63

Browse files
authored
[refactor] Cleanup logs, add defer and remove timeout (#9)
* Remove unnecessary log * Remove delays introduced by setTimeout * Move Lenis script inside head and add defer attribute
1 parent c02aca7 commit 6dbfd63

1 file changed

Lines changed: 17 additions & 28 deletions

File tree

public/index.html

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
<script src="https://www.gstatic.com/firebasejs/ui/9.6.2/firebase-ui-auth.js"></script>
2727
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/9.6.2/firebase-ui-auth.css" />
2828

29+
<!-- Lenis -->
30+
<script src="https://unpkg.com/lenis@1.3.11/dist/lenis.min.js" defer></script>
31+
<script>
32+
document.addEventListener('DOMContentLoaded', () => {
33+
const lenis = new Lenis({ autoRaf: true });
34+
document.getElementById('scroll-down').addEventListener('click', (e) => lenis.scrollTo("#info"));
35+
});
36+
</script>
37+
2938
<!-- Styles -->
3039
<link rel="stylesheet" href="styles/styles.css">
3140
<link rel="icon" type="image/png" href="images/code_society_round.png">
@@ -93,10 +102,10 @@
93102
<p class="title">Our goal</p>
94103
</div>
95104
<div class="col-md-6">
96-
<p class="description">The Code Society has for goal of helping programmers,
97-
scientists and other to find each other to discuss programming, new
98-
technologies, science, and more! We also encourage collaboration on
99-
open source projects as a way to learn, contribute, and grow together as
105+
<p class="description">The Code Society has for goal of helping programmers,
106+
scientists and other to find each other to discuss programming, new
107+
technologies, science, and more! We also encourage collaboration on
108+
open source projects as a way to learn, contribute, and grow together as
100109
a community.
101110
</p>
102111
</div>
@@ -116,10 +125,10 @@
116125
<p class="title">Grace Framework</p>
117126
</div>
118127
<div class="col-md-6">
119-
<p class="description">
120-
<a href="https://github.com/Code-Society-Lab/grace-framework">Grace Framework</a> is an opinionated,
121-
extensible Discord bot framework built on top of discord.py. It comes with a various
122-
tools designed to help you rapidly build scalable, feature-rich Discord bots with
128+
<p class="description">
129+
<a href="https://github.com/Code-Society-Lab/grace-framework">Grace Framework</a> is an opinionated,
130+
extensible Discord bot framework built on top of discord.py. It comes with a various
131+
tools designed to help you rapidly build scalable, feature-rich Discord bots with
123132
minimal boilerplate.
124133
</p>
125134
</div>
@@ -174,26 +183,6 @@
174183
</div>
175184
</div>
176185
</section>
177-
178-
<script src="https://unpkg.com/lenis@1.3.11/dist/lenis.min.js"></script>
179-
<!-- JavaScript for smooth scrolling when arrow clicked -->
180-
<script>
181-
document.getElementById('scroll-down').addEventListener('click', function (e) {
182-
e.preventDefault();
183-
setTimeout(function () {
184-
document.getElementById('info').scrollIntoView({ behavior: 'smooth' });
185-
}, 500);
186-
});
187-
// Initialize Lenis
188-
const lenis = new Lenis({
189-
autoRaf: true,
190-
});
191-
192-
// Listen for the scroll event and log the event data
193-
lenis.on('scroll', (e) => {
194-
console.log(e);
195-
});
196-
</script>
197186
</body>
198187

199188
</html>

0 commit comments

Comments
 (0)