From 65875585d787c49443d79af206f5b73ec5b8874b Mon Sep 17 00:00:00 2001 From: Weitian LI Date: Fri, 25 Apr 2014 01:48:41 +0800 Subject: * app page: finished 'introduction' template page * added related introduction.css and introduction.js --- page/static/js/introduction.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 page/static/js/introduction.js (limited to 'page/static/js') diff --git a/page/static/js/introduction.js b/page/static/js/introduction.js new file mode 100644 index 0000000..b0ff02c --- /dev/null +++ b/page/static/js/introduction.js @@ -0,0 +1,34 @@ +/* + * js for introduction page + */ + +$(document).ready(function() { + $('#sidebar').affix({ + offset: { + top: 235 + } + }); + + var $body = $(document.body); + var navHeight = $('.navbar').outerHeight(true) + 10; + + $body.scrollspy({ + target: '#sidebar-col', + offset: navHeight + }); + + /* smooth scrolling sections */ + $('a[href*=#]:not([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) { + $('html,body').animate({ + scrollTop: target.offset().top - 50 + }, 100); + return false; + } + } + }); +}); + -- cgit v1.2.2