aboutsummaryrefslogtreecommitdiff
path: root/docs/js
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-10-07 14:35:35 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-10-07 14:35:35 +0200
commit2ffc7cfaf05217394708d2c00ab85ab07663d03c (patch)
tree3a239da59946fcb2d6c7b7becd499c7b61e12007 /docs/js
parenta1d8e04af89d4b1ffc0f1c4efe587b8882461d6e (diff)
downloaddotty-2ffc7cfaf05217394708d2c00ab85ab07663d03c.tar.gz
dotty-2ffc7cfaf05217394708d2c00ab85ab07663d03c.tar.bz2
dotty-2ffc7cfaf05217394708d2c00ab85ab07663d03c.zip
Migrate dotty.epfl.ch to static site in repository
Diffstat (limited to 'docs/js')
-rw-r--r--docs/js/index.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/js/index.js b/docs/js/index.js
new file mode 100644
index 000000000..029a9e703
--- /dev/null
+++ b/docs/js/index.js
@@ -0,0 +1,21 @@
+$(document).ready(function() {
+ window.sr = ScrollReveal();
+ sr.reveal(".scala-logo-container", { duration: 2000, delay: 100, mobile: false });
+
+ var hostname = new RegExp(location.host);
+ $('a').each(function(){
+ var url = $(this).attr("href");
+ if (hostname.test(url) || url.slice(0, 1) == "#")
+ $(this).addClass('local');
+ });
+
+ $("a").on('click', function(event) {
+ if ($(this).hasClass("local") && this.hash != "") {
+ event.preventDefault();
+ var hash = this.hash;
+ $('html, body').animate({ scrollTop: $(hash).offset().top }, 800, function() {
+ window.location.hash = hash;
+ });
+ }
+ });
+});