Skip to content

Commit d55b7ed

Browse files
Test
1 parent 6ff674c commit d55b7ed

File tree

5 files changed

+56
-1
lines changed

5 files changed

+56
-1
lines changed

favicon.ico

5.3 KB
Binary file not shown.

favicon.svg

Lines changed: 4 additions & 0 deletions
Loading

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6+
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
7+
<link rel="alternate icon" href="/favicon.ico">
68
<title>Lochlan McElroy | Portfolio</title>
79
<link rel="preconnect" href="https://fonts.googleapis.com"/>
810
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
@@ -155,6 +157,7 @@ <h2>WRAVEN: Student-run cybersecurity group @ WMU</h2>
155157
<p style="margin: 0; font-family: var(--font-mono); text-align: center;">&copy; <span id="currentYear"></span> Lochlan McElroy. All rights reserved.</p>
156158
</footer>
157159

160+
<script src="/scroll-fix.js"></script>
158161
<script src="/script1.js"></script>
159162
<script src="/script2.js"></script>
160163
</body>

scroll-fix.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Prevent auto-scroll to terminal on page load while allowing scripts to run
2+
(function() {
3+
let preventScrolling = true;
4+
let initialLoad = true;
5+
6+
// Override focus to prevent auto-scroll during initial load
7+
const originalFocus = HTMLElement.prototype.focus;
8+
HTMLElement.prototype.focus = function(options) {
9+
if (preventScrolling && initialLoad) {
10+
// Call focus but prevent scrolling during initial load
11+
return originalFocus.call(this, { preventScroll: true });
12+
}
13+
return originalFocus.call(this, options);
14+
};
15+
16+
// Ensure we start at the top
17+
const ensureTopPosition = () => {
18+
if (initialLoad) {
19+
window.scrollTo(0, 0);
20+
document.documentElement.scrollTop = 0;
21+
document.body.scrollTop = 0;
22+
}
23+
};
24+
25+
// Handle immediate scroll prevention
26+
document.addEventListener('DOMContentLoaded', function() {
27+
ensureTopPosition();
28+
29+
// Continue preventing scroll for a short time to let scripts initialize
30+
setTimeout(() => {
31+
preventScrolling = false;
32+
ensureTopPosition(); // One more time after scripts have loaded
33+
}, 500);
34+
});
35+
36+
// Final cleanup after full page load
37+
window.addEventListener('load', function() {
38+
setTimeout(() => {
39+
initialLoad = false;
40+
HTMLElement.prototype.focus = originalFocus; // Restore original focus
41+
ensureTopPosition(); // Final position correction
42+
}, 100);
43+
});
44+
})();

style.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*, *::before, *::after {
1+
*, *::before, *::after {
22
box-sizing: border-box;
33
margin: 0;
44
padding: 0;
@@ -24,6 +24,8 @@
2424
line-height: 1.5;
2525
font-size: 16px;
2626
overflow-x: hidden;
27+
/* Ensure page starts at top */
28+
scroll-behavior: smooth;
2729
}
2830
h1,h2,h3,h4,h5,h6 {
2931
font-family: var(--font-mono);
@@ -276,6 +278,8 @@
276278
font-family: var(--font-mono);
277279
font-size: 0.9rem;
278280
outline: none;
281+
/* Prevent automatic focusing on load */
282+
-webkit-user-modify: read-write-plaintext-only;
279283
}
280284

281285
@keyframes blink {

0 commit comments

Comments
 (0)