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 /layouts/blog | |
parent | 7688b4550d77a48f0998f16715b6aaa79b86b048 (diff) |
Lighter scroll function using jQuery. Updated back-to-top links on single and blog pages to fontawesome arrow.
Diffstat (limited to 'layouts/blog')
-rw-r--r-- | layouts/blog/single.html | 26 |
1 files changed, 10 insertions, 16 deletions
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 |