Template:SUSTC-Shenzhen/themeJs
From 2014.igem.org
(Difference between revisions)
(34 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> | <script> | ||
$.pjax({ | $.pjax({ | ||
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 45: | Line 45: | ||
window.ga('create', 'UA-42690126-5', 'auto'); | window.ga('create', 'UA-42690126-5', 'auto'); | ||
+ | window.ga('require', 'linkid', 'linkid.js'); | ||
+ | window.ga('require', 'displayfeatures'); | ||
window.ga('send', 'pageview'); | window.ga('send', 'pageview'); | ||
} else { | } else { | ||
Line 50: | Line 52: | ||
} | } | ||
+ | </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