Team:NTU-Taida/Templates/Footer
From 2013.igem.org
(Difference between revisions)
Line 6: | Line 6: | ||
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | ||
<script type="text/javascript" src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/js/bootstrap.min.js"></script> | <script type="text/javascript" src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/js/bootstrap.min.js"></script> | ||
- | <script type="text/javascript" src="http://bootswatch.com/js/bootswatch.js"></script> | + | <!--<script type="text/javascript" src="http://bootswatch.com/js/bootswatch.js"></script>--> |
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> | <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> | ||
Line 117: | Line 117: | ||
}); | }); | ||
+ | //subnav fixed top~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
+ | |||
+ | $('a[rel=tooltip]').tooltip({ | ||
+ | 'placement': 'bottom' | ||
+ | }); | ||
+ | |||
+ | |||
+ | $('.navbar a, .subnav a').smoothScroll(); | ||
+ | |||
+ | |||
+ | (function ($) { | ||
+ | |||
+ | $(function(){ | ||
+ | |||
+ | // fix sub nav on scroll | ||
+ | var $win = $(window), | ||
+ | $content = $('body'), | ||
+ | $nav = $('.subnav'), | ||
+ | navHeight = $('.navbar').first().height(), | ||
+ | subnavHeight = $('.subnav').first().height(), | ||
+ | subnavTop = $('.subnav').length && $('.subnav').offset().top - navHeight, | ||
+ | marginTop = parseInt($body.css('margin-top'), 10); | ||
+ | isFixed = 0; | ||
+ | |||
+ | processScroll(); | ||
+ | |||
+ | $win.on('scroll', processScroll); | ||
+ | |||
+ | function processScroll() { | ||
+ | var i, scrollTop = $win.scrollTop(); | ||
+ | |||
+ | if (scrollTop >= subnavTop && !isFixed) { | ||
+ | isFixed = 1; | ||
+ | $nav.addClass('subnav-fixed'); | ||
+ | $body.css('margin-top', marginTop + subnavHeight + 'px'); | ||
+ | } else if (scrollTop <= subnavTop && isFixed) { | ||
+ | isFixed = 0; | ||
+ | $nav.removeClass('subnav-fixed'); | ||
+ | $body.css('margin-top', marginTop + 'px'); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | |||
+ | })(window.jQuery); | ||
</script> | </script> | ||
<p></html> | <p></html> |
Revision as of 13:27, 1 August 2013