Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit efdc3dc

Browse files
author
TheSparkPlays
committed
Bug Fixes
Fixed the issue were the page will auto-scroll to the bottom on certain computers/phones.
1 parent 1634a07 commit efdc3dc

File tree

2 files changed

+39
-29
lines changed

2 files changed

+39
-29
lines changed

css/main.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ a:hover {
6363
transition: all .2s ease-in;
6464
font-weight: 700;
6565
text-transform: uppercase;
66-
position: sticky;
66+
position: fixed;
67+
width: 100%;
6768
top: 0;
6869
z-index: 1;
6970
}

index.html

+37-28
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
if they're not showing, one of the links could be broken!
1111
1212
Need support?
13-
Leave a comment on the SpigotMC page
13+
PM me on SpigotMC (https://www.spigotmc.org/members/gewoonrick.31710/)
1414
1515
See anything broken?
16-
Leave a comment on the SpigotMC page
16+
PM me on SpigotMC (https://www.spigotmc.org/members/gewoonrick.31710/)
1717
1818
-->
1919
<!DOCTYPE html>
@@ -51,7 +51,7 @@
5151
<a href="#gamemodes">Gamemodes</a>
5252
<a href="#vote">Vote</a>
5353
<a href="#staff">Staff</a>
54-
<a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">&#9776;</a>
54+
<a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">&#9776;</a>
5555
</div>
5656
</div>
5757
<!-- End Navbar -->
@@ -294,36 +294,45 @@ <h2>Some dude</h2>
294294
</footer>
295295
<!-- End Footer -->
296296

297-
<!-- Smooth Scrolling Script | Do not touch if you don't know what you're doing! -->
298-
<script type="text/javascript">
299-
window.scroll({
300-
top: 2500, //Can be edited
301-
left: 0, //Can be edited, you should not.
302-
behavior: 'smooth' //Should not edit
303-
});
304-
305-
window.scrollBy({
306-
top: -100, //Can be edited
307-
left: 0, //Can be edited, you should not.
308-
behavior: 'smooth' //Should not edit
309-
});
310-
311-
//Should not edit
312-
document.querySelector('.hello').scrollIntoView({
313-
behavior: 'smooth'
297+
<!-- Smooth Scrolling Script (from https://goo.gl/uWLqWu) | Do not touch if you don't know what you're doing! -->
298+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
299+
<script>
300+
$(document).ready(function(){
301+
// Add smooth scrolling to all links
302+
$("a").on('click', function(event) {
303+
304+
// Make sure this.hash has a value before overriding default behavior
305+
if (this.hash !== "") {
306+
// Prevent default anchor click behavior
307+
event.preventDefault();
308+
309+
// Store hash
310+
var hash = this.hash;
311+
312+
// Using jQuery's animate() method to add smooth page scroll
313+
// The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
314+
$('html, body').animate({
315+
scrollTop: $(hash).offset().top
316+
}, 100, function(){
317+
318+
// Add hash (#) to URL when done scrolling (default click behavior)
319+
window.location.hash = hash;
320+
});
321+
} // End if
322+
});
314323
});
315324
</script>
316325
<!-- End Smooth Scrolling Script -->
317326

318327
<script>
319-
function myFunction() {
320-
var x = document.getElementById("myTopnav");
321-
if (x.className === "topnav") {
322-
x.className += " responsive";
323-
} else {
324-
x.className = "topnav";
325-
}
326-
}
328+
function myFunction() {
329+
var x = document.getElementById("myTopnav");
330+
if (x.className === "topnav") {
331+
x.className += " responsive";
332+
} else {
333+
x.className = "topnav";
334+
}
335+
}
327336
</script>
328337

329338
</body>

0 commit comments

Comments
 (0)