1jQuery(document).ready(function($){ 2 var contentSections = $('.cd-section'), 3 navigationItems = $('#cd-vertical-nav a'); 4 5 updateNavigation(); 6 $(window).on('scroll', function(){ 7 updateNavigation(); 8 }); 9 10 //smooth scroll to the section 11 navigationItems.on('click', function(event){ 12 event.preventDefault(); 13 smoothScroll($(this.hash)); 14 }); 15 //smooth scroll to second section 16 $('.cd-scroll-down').on('click', function(event){ 17 event.preventDefault(); 18 smoothScroll($(this.hash)); 19 }); 20 21 //open-close navigation on touch devices 22 $('.touch .cd-nav-trigger').on('click', function(){ 23 $('.touch #cd-vertical-nav').toggleClass('open'); 24 25 }); 26 //close navigation on touch devices when selectin an elemnt from the list 27 $('.touch #cd-vertical-nav a').on('click', function(){ 28 $('.touch #cd-vertical-nav').removeClass('open'); 29 }); 30 31 function updateNavigation() { 32 contentSections.each(function(){ 33 $this = $(this); 34 var activeSection = $('#cd-vertical-nav a[href="#'+$this.attr('id')+'"]').data('number') - 1; 35 if ( ( $this.offset().top - $(window).height()/2 < $(window).scrollTop() ) && ( $this.offset().top + $this.height() - $(window).height()/2 > $(window).scrollTop() ) ) { 36 navigationItems.eq(activeSection).addClass('is-selected'); 37 }else { 38 navigationItems.eq(activeSection).removeClass('is-selected'); 39 } 40 }); 41 } 42 43 function smoothScroll(target) { 44 $('body,html').animate( 45 {'scrollTop':target.offset().top}, 46 600 47 ); 48 } 49});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.