Template:SUSTC-Shenzhen/themeJs
From 2014.igem.org
(Difference between revisions)
(40 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
<html> | <html> | ||
<footer> | <footer> | ||
- | <script src="// | + | <script src="https://2014.igem.org/Team:SUSTC-Shenzhen/js/pace.min.js?action=raw&ctype=text/javascript"></script> |
<script src="//2014.igem.org/Team:SUSTC-Shenzhen/static/js/jquery.pjax.js?action=raw&ctype=text/javascript"></script> | <script src="//2014.igem.org/Team:SUSTC-Shenzhen/static/js/jquery.pjax.js?action=raw&ctype=text/javascript"></script> | ||
- | <script src="// | + | <script src="https://2014.igem.org/Team:SUSTC-Shenzhen/js/bootstrap.min.js?action=raw&ctype=text/javascript"></script> |
- | + | <script> | |
$.pjax({ | $.pjax({ | ||
area: 'body', | area: 'body', | ||
Line 18: | Line 18: | ||
$("#nav-login-status") | $("#nav-login-status") | ||
.text(wgUserName) | .text(wgUserName) | ||
- | .attr("href"," | + | .attr("href","https://igem.org/User_Information"); |
} else { | } else { | ||
$("#nav-login-status") | $("#nav-login-status") | ||
Line 28: | Line 28: | ||
if(val.href===window.location.href){ | if(val.href===window.location.href){ | ||
val.href="#"; | val.href="#"; | ||
- | val.parent().addClass("active"); | + | $(val).parent().addClass("active"); |
} | } | ||
}); | }); | ||
Line 35: | Line 35: | ||
updateNav(); | updateNav(); | ||
+ | |||
</script> | </script> | ||
<script> | <script> | ||
- | (function(i, s, o, g, r, a, m) { | + | if (!window.ga) { |
- | + | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
- | + | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
- | + | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
- | + | })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
- | + | ||
- | + | window.ga('create', 'UA-42690126-5', 'auto'); | |
- | + | window.ga('require', 'linkid', 'linkid.js'); | |
- | + | window.ga('require', 'displayfeatures'); | |
- | + | window.ga('send', 'pageview'); | |
- | })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); | + | } else { |
+ | window.ga('send', 'pageview', window.location.pathname+window.location.search); | ||
+ | } | ||
+ | |||
+ | </script> | ||
+ | <script> | ||
+ | $('#page-contents a').click(function() { | ||
+ | console.log(this.hash); | ||
+ | if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') | ||
+ | || location.hostname == this.hostname) { | ||
- | + | var target = $('[id="'+this.hash.substring(1)+'"]'); | |
- | + | target = target.length ? target : $('[name="' + this.hash.slice(1) +'"]'); | |
+ | if (target.length) { | ||
+ | $('html,body').animate({ | ||
+ | scrollTop: target.offset().top-70 | ||
+ | }, 1000); | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | $(document.body).scrollspy({ | ||
+ | target: '.bs-docs-sidebar', | ||
+ | offset: 71 | ||
+ | }); | ||
+ | setTimeout(function () { | ||
+ | var $sideBar = $('.bs-docs-sidebar') | ||
+ | |||
+ | $sideBar.affix({ | ||
+ | offset: { | ||
+ | top: function () { | ||
+ | var offsetTop = $sideBar.offset().top | ||
+ | var sideBarMargin = parseInt($sideBar.children(0).css('margin-top'), 10) | ||
+ | var navOuterHeight = $('#index-nav-main').height() | ||
+ | |||
+ | return (this.top = offsetTop - navOuterHeight - sideBarMargin) | ||
+ | }, | ||
+ | bottom: function () { | ||
+ | return (this.bottom = $('.bs-docs-footer').outerHeight(true)) | ||
+ | } | ||
+ | } | ||
+ | }) | ||
+ | }, 100) | ||
</script> | </script> | ||
</footer> | </footer> | ||
</html> | </html> |
Latest revision as of 09:49, 17 October 2014