|
|
Line 8: |
Line 8: |
| }); | | }); |
| | | |
− | function isScrolledIntoView(elem)
| |
− | {
| |
− | var docViewTop = $(window).scrollTop();
| |
− | var docViewBottom = docViewTop + $(window).height();
| |
− |
| |
− | var elemTop = $(elem).offset().top;
| |
− | var elemBottom = elemTop + $(elem).height();
| |
− |
| |
− | return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
| |
− | }
| |
− |
| |
− | $(document).ready(function(){
| |
− | //$(".backToTop").hide(0);
| |
− | if (window.innerWidth>600){
| |
− | $(window).scroll(function(){
| |
− | /*$('body').addClass('header-fixed');*/
| |
− | if ($(this).scrollTop() > 500) {
| |
− | $('body').addClass('header-fixed');
| |
− | //$(".backToTop").show(500);
| |
− | if ($(this).scrollTop() > 580){
| |
− | $('#vertical_nav').addClass('can_move');
| |
− | }
| |
− | else{
| |
− | $('#vertical_nav').removeClass('can_move');
| |
− | }
| |
− | } else {
| |
− | $('body').removeClass('header-fixed');
| |
− | //$(".backToTop").hide(500);
| |
− | }
| |
− | /*if (isScrolledIntoView('footer')){
| |
− | $(".backToTop").hide(500);
| |
− | }*/
| |
− | });
| |
− | }
| |
− | });
| |
− |
| |
− |
| |
− | $(document).ready(function(){
| |
− | $('.icon').click(function(e){
| |
− | $('body').toggleClass('with--sidebar');
| |
− | });
| |
− |
| |
− | $('#site-cache').click(function(e){
| |
− | $('body').removeClass('with--sidebar');
| |
− | });
| |
− |
| |
− | });
| |
− |
| |
− |
| |
− | $(document).ready(function($){
| |
− | var contentSections = $('.article_offset'),
| |
− | navigationItems = $('#vertical_nav .aside_circle');
| |
− |
| |
− | updateNavigation();
| |
− | $(window).on('scroll', function(){
| |
− | updateNavigation();
| |
− | });
| |
− |
| |
− |
| |
− | function updateNavigation() {
| |
− | contentSections.each(function(){
| |
− | $this = $(this);
| |
− |
| |
− | var activeSection = $('#vertical_nav a[href="#'+$this.attr('id')+'"]').data('number') - 1;
| |
− | if ( ( $this.offset().top - $(window).height()/2 < $(window).scrollTop() ) && ( $this.offset().top + $this.height() - $(window).height()/2 > $(window).scrollTop() ) ) {
| |
− | navigationItems.eq(activeSection).addClass('is-selected');
| |
− | }else {
| |
− | navigationItems.eq(activeSection).removeClass('is-selected');
| |
− | }
| |
− | });
| |
− | }
| |
− |
| |
− | function smoothScroll(target) {
| |
− | $('body,html').animate(
| |
− | {'scrollTop':target.offset().top},
| |
− | 600
| |
− | );
| |
− | }
| |
− | });
| |
| | | |
| </script> | | </script> |
| </html> | | </html> |