From d63d4b489af735651cee9d50357aa84106a19cd2 Mon Sep 17 00:00:00 2001 From: Gabriel Albo Date: Thu, 21 Aug 2014 10:33:22 -0300 Subject: Moving smooth transition js funtion to a specific style-guide js file --- web-ui/app/js/style_guide/main.js | 16 ++++++++++++++++ web-ui/app/style-guide.html | 23 +++-------------------- 2 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 web-ui/app/js/style_guide/main.js (limited to 'web-ui') diff --git a/web-ui/app/js/style_guide/main.js b/web-ui/app/js/style_guide/main.js new file mode 100644 index 00000000..d9092641 --- /dev/null +++ b/web-ui/app/js/style_guide/main.js @@ -0,0 +1,16 @@ +$(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; + } + } + }); +}); \ No newline at end of file diff --git a/web-ui/app/style-guide.html b/web-ui/app/style-guide.html index d24f0bda..ee6b89fd 100644 --- a/web-ui/app/style-guide.html +++ b/web-ui/app/style-guide.html @@ -12,26 +12,6 @@ - - -
+ + + -- cgit v1.2.3