-
Notifications
You must be signed in to change notification settings - Fork 0
/
scroll-lock.min.js
6 lines (6 loc) · 3.06 KB
/
scroll-lock.min.js
1
2
3
4
5
6
/*!
* @license scroll-lock.js Copyright(c) 2016 sasa+1
* https://github.com/sasaplus1-prototype/scroll-lock.js
* Released under the MIT license.
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.scrollLock=t():e.scrollLock=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){e.preventDefault()}function r(){m||(m="onwheel"in document?"wheel":"onmousewheel"in document?"mousewheel":"DOMMouseScroll"),v.on(window,"scroll",n),v.on(document,"touchmove",n),v.on(document,m,n)}function c(){m||(m="onwheel"in document?"wheel":"onmousewheel"in document?"mousewheel":"DOMMouseScroll"),v.off(window,"scroll",n),v.off(document,"touchmove",n),v.off(document,m,n)}function l(){var e,t;return e=w.get(),a||(a=document.body),t={top:a.style.top,width:a.style.width,position:a.style.position},a.style.top="-"+e+"px",a.style.width="100%",a.style.position="fixed",t}function u(e){var t;e||(e={}),a||(a=document.body),/^-.*px$/.test(a.style.top)&&(t=parseFloat(a.style.top.replace(/^-/,"").replace(/px$/,""))),a.style.position=e.position||"",a.style.width=e.width||"",a.style.top=e.top||"",t&&w.set(t)}function s(){var e;return p||(p=document.documentElement),a||(a=document.body),e={htmlOverflow:p.style.overflow,bodyOverflow:a.style.overflow},p.style.overflow="hidden",a.style.overflow="hidden",e}function i(e){e||(e={}),p||(p=document.documentElement),a||(a=document.body),p.style.overflow=e.htmlOverflow||"",a.style.overflow=e.bodyOverflow||""}function d(e){switch(e){case"event":return r();case"overflow":return s();case"fixed":case"position":default:return l()}}function f(e,t){switch(null!==e&&"object"==typeof e&&"undefined"==typeof t&&(t=e,e=void 0),e){case"event":c();break;case"overflow":i(t);break;case"fixed":case"position":default:u(t)}}var p,a,m,v=o(1),w=o(2);e.exports={lock:d,unlock:f}},function(e,t){"use strict";function o(e,t,o,c){var l=function(){switch(n(e,t,l,c),arguments.length){case 0:return o.call(this);case 1:return o.call(this,arguments[0]);case 2:return o.call(this,arguments[0],arguments[1]);case 3:return o.call(this,arguments[0],arguments[1],arguments[2]);default:return o.apply(this,arguments)}};return r(e,t,l,c)}var n="undefined"!=typeof removeEventListener?function(e,t,o,n){return e.removeEventListener(t,o,n)}:function(e,t,o){return e.detachEvent("on"+t,o)},r="undefined"!=typeof addEventListener?function(e,t,o,n){return e.addEventListener(t,o,n)}:function(e,t,o){return e.attachEvent("on"+t,o)};e.exports={off:n,on:r,once:o}},function(e,t){"use strict";function o(){var e;return void 0!==window.pageYOffset?e=window.pageYOffset:(r||(r=document.body),c||(c=document.documentElement),e=c.scrollTop||r.parentNode.scrollTop||r.scrollTop),e}function n(e){r||(r=document.body),c||(c=document.documentElement),r.scrollTop=e,c.scrollTop=e}var r,c;e.exports={get:o,set:n}}])});