diff options
author | Gabriel Albo <gabriel@albo.com.br> | 2014-08-21 09:52:34 -0300 |
---|---|---|
committer | Gabriel Albo <gabriel@albo.com.br> | 2014-08-21 09:52:48 -0300 |
commit | 4d0b890c995b1a03b1099bd6913d20384877480f (patch) | |
tree | 256b3f515a7cc7876f89c7bf419608d01f7a3a30 /web-ui/app/style-guide.html | |
parent | 2ff918d4de6fa0b0d2436737815c3f58ad698560 (diff) |
Adding jquery dependency and a smoothier transition between sections when scrolling via anchors on the style guide
Diffstat (limited to 'web-ui/app/style-guide.html')
-rw-r--r-- | web-ui/app/style-guide.html | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/web-ui/app/style-guide.html b/web-ui/app/style-guide.html index 354d9307..d24f0bda 100644 --- a/web-ui/app/style-guide.html +++ b/web-ui/app/style-guide.html @@ -12,6 +12,25 @@ <link href="css/style-guide.css" rel="stylesheet" type="text/css"/> <link rel="stylesheet" href="../css/main.css"> </head> +<script src="/bower_components/jquery/dist/jquery.js"></script> +<script type="text/javascript"> + $(document).ready(function(){ + $('a[href*=#]').click(function() { + if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') + && location.hostname == this.hostname) { + var $target = $(this.hash); + $target = $target.length && $target + || $('[name=' + this.hash.slice(1) +']'); + if ($target.length) { + var targetOffset = $target.offset().top; + $('html,body') + .animate({scrollTop: targetOffset}, 500); + return false; + } + } + }); + }); +</script> <body> <div id="style-guide-wrap" data-offcanvas> |