diff options
author | Vicky <vicky@vickylai.com> | 2017-04-20 06:06:33 +0300 |
---|---|---|
committer | Vicky <vicky@vickylai.com> | 2017-04-20 06:06:33 +0300 |
commit | 4fed8557d87e3c88f4a121c16e421fdf72d0e88c (patch) | |
tree | 81f3f3d1c2d814ec84654f2cbd585ddcbfe9af54 | |
parent | 7688b4550d77a48f0998f16715b6aaa79b86b048 (diff) |
Lighter scroll function using jQuery. Updated back-to-top links on single and blog pages to fontawesome arrow.
-rw-r--r-- | layouts/_default/list.html | 26 | ||||
-rw-r--r-- | layouts/blog/single.html | 26 | ||||
-rw-r--r-- | layouts/index.html | 25 | ||||
-rw-r--r-- | layouts/partials/header.html | 7 |
4 files changed, 32 insertions, 52 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index ecf0326..9451479 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -43,7 +43,7 @@ <div class="container has-text-centered top-pad"> <hr> -<a href="{{ .Permalink }}#top">TOP</a> +<a href="{{ .Permalink }}#top"><i class="fa fa-arrow-up"></i></a> <hr> </div> @@ -51,20 +51,14 @@ </div><!-- End fade in two --> </div><!-- End parent section --> -<!-- Cool scroll effect from this guy: https://gist.github.com/flesler/ --> -<!-- Include jQuery from somewhere, must use version 1.8 or above --> -<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> -<!-- Include latest jquery.scrollTo, can download from https://github.com/flesler/jquery.scrollTo/releases --> -<script type="application/javascript" src="//cdn.jsdelivr.net/jquery.scrollto/2.1.2/jquery.scrollTo.min.js"></script> -<!-- Initialize the plugin, the contents of the script can be inlined here, of course --> -<script type="text/javascript" src={{ "js/init.js" | relURL }}></script> +<!-- Bitty scrolling links script --> <script> - // Bind to the click of all links with a #hash in the href - $('a[href^="{{ .Permalink }}#"]').click(function(e) { - // Prevent the jump and the #hash from appearing on the address bar +$('a[href^="{{ .Permalink }}#"]').click(function(e) { e.preventDefault(); - // Scroll the window, stop any previous animation, stop on user manual scroll - // Check https://github.com/flesler/jquery.scrollTo for more customizability - $(window).stop(true).scrollTo(this.hash, {duration:500, interrupt:false}); - }); - </script>
\ No newline at end of file + var target = this.hash; + $('html, body').animate({ + scrollTop: $(target).offset().top + }, 500); + return false; +}) +</script>
\ No newline at end of file diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 5b84673..760c31d 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -58,7 +58,7 @@ <div class="container has-text-centered top-pad"> <hr> -<a href="{{ .Permalink }}#top">TOP</a> +<a href="{{ .Permalink }}#top"><i class="fa fa-arrow-up"></i></a> <hr> </div> @@ -66,20 +66,14 @@ </div><!-- End fade in two --> </div><!-- End parent section --> -<!-- Cool scroll effect from this guy: https://gist.github.com/flesler/ --> -<!-- Include jQuery from somewhere, must use version 1.8 or above --> -<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> -<!-- Include latest jquery.scrollTo, can download from https://github.com/flesler/jquery.scrollTo/releases --> -<script type="application/javascript" src="//cdn.jsdelivr.net/jquery.scrollto/2.1.2/jquery.scrollTo.min.js"></script> -<!-- Initialize the plugin, the contents of the script can be inlined here, of course --> -<script type="text/javascript" src={{ "js/init.js" | relURL }}></script> +<!-- Bitty scrolling links script --> <script> - // Bind to the click of all links with a #hash in the href - $('a[href^="{{ .Permalink }}#"]').click(function(e) { - // Prevent the jump and the #hash from appearing on the address bar +$('a[href^="{{ .Permalink }}#"]').click(function(e) { e.preventDefault(); - // Scroll the window, stop any previous animation, stop on user manual scroll - // Check https://github.com/flesler/jquery.scrollTo for more customizability - $(window).stop(true).scrollTo(this.hash, {duration:500, interrupt:false}); - }); - </script>
\ No newline at end of file + var target = this.hash; + $('html, body').animate({ + scrollTop: $(target).offset().top + }, 500); + return false; +}) +</script>
\ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html index da6dfbd..972c636 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -35,7 +35,6 @@ {{ if .Site.Params.showblog }} <a class="nav-item" href="#blog">Blog</a> {{ end }} - <a class="nav-item" href="#workwithme">Work With Me</a> <a class="nav-item" href="#contact">Contact</a> </nav> <hr> @@ -120,20 +119,14 @@ </div><!-- End of fade in three section --> <!-- Where all the awesome ends. Aww. --> -<!-- Cool scroll effect from this guy: https://gist.github.com/flesler/ --> -<!-- Include jQuery from somewhere, must use version 1.8 or above --> -<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> -<!-- Include latest jquery.scrollTo, can download from https://github.com/flesler/jquery.scrollTo/releases --> -<script type="application/javascript" src="//cdn.jsdelivr.net/jquery.scrollto/2.1.2/jquery.scrollTo.min.js"></script> -<!-- Initialize the plugin, the contents of the script can be inlined here, of course --> -<script type="text/javascript" src={{ "js/init.js" | relURL }}></script> +<!-- Bitty scrolling links script --> <script> - // Bind to the click of all links with a #hash in the href - $('a[href^="#"]').click(function(e) { - // Prevent the jump and the #hash from appearing on the address bar +$('a[href^="#"]').click(function(e) { e.preventDefault(); - // Scroll the window, stop any previous animation, stop on user manual scroll - // Check https://github.com/flesler/jquery.scrollTo for more customizability - $(window).stop(true).scrollTo(this.hash, {duration:500, interrupt:false}); - }); - </script>
\ No newline at end of file + var target = this.hash; + $('html, body').animate({ + scrollTop: $(target).offset().top + }, 500); + return false; +}) +</script>
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 3fa2ce9..80fbff9 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -34,17 +34,16 @@ {{ end }} <!-- CSS --> - {{ if .Site.Params.highlightjs }} <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/default.min.css"> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script> {{ end }} -<!-- Fonts and icon CSS --> +<!-- jQuery --> +<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> -<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.0/jquery.scrollTo.min.js"> -<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">--> +<!-- Fonts and icon CSS --> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Ubuntu+Mono:400,400i,700,700i|Raleway:500|Work+Sans"> |