1// Page Scroll script 2//## 3 4function scrollTo2(id) { 5 var scrollCoordinates = $(id).offset().top - $(".navbar").height() - 10; 6 disableScroll(); 7 $('html, body').stop().animate({ 8 scrollTop: scrollCoordinates 9 }, $(id).offset().top, function () { enableScroll() }); 10} 11 12$(window).on('load', function () { 13 if (location.hash) { 14 var hash = window.location.hash; 15 if (hash) { $(window).scrollTop(0); scrollTo2(hash); } 16 } 17}); 18 19// left: 37, up: 38, right: 39, down: 40, 20// spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36 21var keys = { 37: 1, 38: 1, 39: 1, 40: 1 }; 22 23function preventDefault(e) { 24 e = e || window.event; 25 if (e.preventDefault) 26 e.preventDefault(); 27 e.returnValue = false; 28} 29 30function preventDefaultForScrollKeys(e) { 31 if (keys[e.keyCode]) { 32 preventDefault(e); 33 return false; 34 } 35} 36 37function disableScroll() { 38 if (window.addEventListener) // older FF 39 window.addEventListener('DOMMouseScroll', preventDefault, false); 40 window.onwheel = preventDefault; // modern standard 41 window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE 42 window.ontouchmove = preventDefault; // mobile 43 document.onkeydown = preventDefaultForScrollKeys; 44} 45 46function enableScroll() { 47 if (window.removeEventListener) 48 window.removeEventListener('DOMMouseScroll', preventDefault, false); 49 window.onmousewheel = document.onmousewheel = null; 50 window.onwheel = null; 51 window.ontouchmove = null; 52 document.onkeydown = null; 53}
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.