Skip to content

Commit fbcd79f

Browse files
committed
Fix smooth scrolling on index doc page
Somehow the animation with Javascript was broken, as it scrolled up the top and than jupped the actual target. Since ~70% of all browser support this with pure CSS today, this should be good enough for this minor feature. The 'local' class was only used within JavaScript so it was dropped.
1 parent 673febf commit fbcd79f

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

docs/css/default.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
html, body {
88
box-sizing: border-box;
9+
scroll-behavior: smooth;
910
}
1011

1112
*, *:before, *:after {

docs/js/index.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
11
$(document).ready(function() {
22
window.sr = ScrollReveal();
33
sr.reveal(".scala-logo-container", { duration: 2000, delay: 100, mobile: false });
4-
5-
var hostname = new RegExp(location.host);
6-
$('a').each(function(){
7-
var url = $(this).attr("href");
8-
if (hostname.test(url) || url.slice(0, 1) == "#")
9-
$(this).addClass('local');
10-
});
11-
12-
$("a").on('click', function(event) {
13-
if ($(this).hasClass("local") && this.hash != "") {
14-
event.preventDefault();
15-
var hash = this.hash;
16-
$('html, body').animate({ scrollTop: $(hash).offset().top }, 800, function() {
17-
window.location.hash = hash;
18-
});
19-
}
20-
});
214
});

0 commit comments

Comments
 (0)