Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/autoscroll.min.js |
define ("core/autoscroll",["jquery"],function(a){var b={SCROLL_THRESHOLD:30,SCROLL_FREQUENCY:1e3/60,SCROLL_SPEED:.5,scrollingId:null,scrollAmount:0,callback:null,start:function start(c){a(window).on("mousemove",b.mouseMove);a(window).on("touchmove",b.touchMove);b.callback=c},stop:function stop(){a(window).off("mousemove",b.mouseMove);a(window).off("touchmove",b.touchMove);if(null!==b.scrollingId){b.stopScrolling()}},touchMove:function touchMove(a){for(var c=0;c<a.changedTouches.length;c++){b.handleMove(a.changedTouches[c].clientX,a.changedTouches[c].clientY)}},mouseMove:function mouseMove(a){b.handleMove(a.clientX,a.clientY)},handleMove:function handleMove(c,d){if(d<b.SCROLL_THRESHOLD){b.scrollAmount=-Math.min(b.SCROLL_THRESHOLD-d,b.SCROLL_THRESHOLD)}else if(d>a(window).height()-b.SCROLL_THRESHOLD){b.scrollAmount=Math.min(d-(a(window).height()-b.SCROLL_THRESHOLD),b.SCROLL_THRESHOLD)}else{b.scrollAmount=0}if(b.scrollAmount&&null===b.scrollingId){b.startScrolling()}else if(!b.scrollAmount&&null!==b.scrollingId){b.stopScrolling()}},startScrolling:function startScrolling(){var c=a(document).height()-a(window).height();b.scrollingId=window.setInterval(function(){var d=a(window).scrollTop(),e=Math.round(b.scrollAmount*b.SCROLL_SPEED);if(0>d+e){e=-d}if(d+e>c){e=c-d}if(0===e){return}a(window).scrollTop(d+e);var f=a(window).scrollTop()-d;if(0==f){return}if(b.callback){b.callback(f)}},b.SCROLL_FREQUENCY)},stopScrolling:function stopScrolling(){window.clearInterval(b.scrollingId);b.scrollingId=null}};return{start:b.start,stop:b.stop}}); //# sourceMappingURL=autoscroll.min.js.map