1; 2(function ($) { 3 "use strict" 4 /*************************** 5 ## Single page scrolling ## 6 ****************************/ 7 var graTh = { 8 onePageMenu: function() { 9 function onePageNav($selector) { 10 var $navSelector = $($selector); 11 $navSelector 12 .not('[href="#"]') 13 .not('[href="#0"]') 14 .on('click', function(event) { 15 if ( location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname ) { 16 var target = $(this.hash); 17 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 18 19 $navSelector.removeClass("active"); 20 if( target.length) { 21 if($(this)[0].hash.slice(1) === target[0].id) { 22 $(this).addClass("active"); 23 } else { 24 $(this).removeClass("active"); 25 } 26 } 27 28 if (target.length) { 29 event.preventDefault(); 30 $('html, body').animate({ 31 scrollTop: target.offset().top 32 }, 1000); 33 } 34 } 35 }); 36 37 $navSelector.each(function(event) { 38 var target = $(this.hash); 39 if( target.length) { 40 if(location.hash.slice(1) === target[0].id) { 41 $(this).addClass("active"); 42 } else if(!location.hash) { 43 44 } else { 45 $(this).removeClass("active"); 46 } 47 } 48 }); 49 50 function onScroll(event){ 51 var scrollPos = $(document).scrollTop(); 52 $navSelector.each(function () { 53 var currLink = $(this); 54 if(currLink[0].hash !== "" && $(currLink[0].hash).position() !== undefined) { 55 56 var $getNavHas = $(currLink).prop('href').split('#')[1], 57 $getSection = $('#' + $getNavHas); 58 59 $getSection.each(function() { 60 var $topPos = $(this).offset().top, 61 $topPosRound = Math.round($topPos - 120), 62 $presentPos = Math.round(scrollPos); 63 64 if ($topPosRound <= $presentPos && $topPosRound + $(this).height() > $presentPos) { 65 $(currLink).parent().addClass("active"); 66 } else { 67 $(currLink).parent().removeClass("active"); 68 } 69 }); 70 } else { 71 return false; 72 } 73 }); 74 } 75 76 $(document).on("scroll", onScroll); 77 } 78 onePageNav('#gnav li a') 79 }, 80 initializ: function() { 81 graTh.onePageMenu(); 82 } 83 }; 84 $(function() { 85 graTh.initializ(); 86 }) 87 /*====== End onpage scrolling js ========*/ 88})(jQuery)
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.