1// Custom scrolling speed with jQuery 2// Source: github.com/ByNathan/jQuery.scrollSpeed 3// Version: 1.0.2 4 5(function($) { 6 7 jQuery.scrollSpeed = function(step, speed, easing) { 8 9 var $document = $(document), 10 $window = $(window), 11 $body = $('html, body'), 12 option = easing || 'default', 13 root = 0, 14 scroll = false, 15 scrollY, 16 scrollX, 17 view; 18 19 if (window.navigator.msPointerEnabled) 20 21 return false; 22 23 $window.on('mousewheel DOMMouseScroll', function(e) { 24 25 var deltaY = e.originalEvent.wheelDeltaY, 26 detail = e.originalEvent.detail; 27 scrollY = $document.height() > $window.height(); 28 scrollX = $document.width() > $window.width(); 29 scroll = true; 30 31 if (scrollY) { 32 33 view = $window.height(); 34 35 if (deltaY < 0 || detail > 0) 36 37 root = (root + view) >= $document.height() ? root : root += step; 38 39 if (deltaY > 0 || detail < 0) 40 41 root = root <= 0 ? 0 : root -= step; 42 43 $body.stop().animate({ 44 45 scrollTop: root 46 47 }, speed, option, function() { 48 49 scroll = false; 50 51 }); 52 } 53 54 if (scrollX) { 55 56 view = $window.width(); 57 58 if (deltaY < 0 || detail > 0) 59 60 root = (root + view) >= $document.width() ? root : root += step; 61 62 if (deltaY > 0 || detail < 0) 63 64 root = root <= 0 ? 0 : root -= step; 65 66 $body.stop().animate({ 67 68 scrollLeft: root 69 70 }, speed, option, function() { 71 72 scroll = false; 73 74 }); 75 } 76 77 return false; 78 79 }).on('scroll', function() { 80 81 if (scrollY && !scroll) root = $window.scrollTop(); 82 if (scrollX && !scroll) root = $window.scrollLeft(); 83 84 }).on('resize', function() { 85 86 if (scrollY && !scroll) view = $window.height(); 87 if (scrollX && !scroll) view = $window.width(); 88 89 }); 90 }; 91 92 jQuery.easing.default = function (x,t,b,c,d) { 93 94 return -c * ((t=t/d-1)*t*t*t - 1) + b; 95 }; 96 97})(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.