public/static/jquery-slimscroll/jquery.slimscroll.min.js
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
!function(e){e.fn.extend({slimScroll:function(i){var o=e.extend({width:"auto",height:"250px",overflow:!0,size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},i);return this.each(function(){var a,r,s,l,n,c,h,u,p="<div></div>",d=30,g=!1,f=e(this);if(f.parent().hasClass(o.wrapperClass)){var v=f.scrollTop();if(y=f.parent().find("."+o.barClass),m=f.parent().find("."+o.railClass),C(),e.isPlainObject(i)){if("height"in i&&"auto"==i.height){f.parent().css("height","auto"),f.css("height","auto");var b=f.parent().parent().height();f.parent().css("height",b),f.css("height",b)}if("scrollTo"in i)v=parseInt(o.scrollTo);else if("scrollBy"in i)v+=parseInt(o.scrollBy);else if("destroy"in i)return y.remove(),m.remove(),void f.unwrap();x(v,!1,!0)}}else if(!(e.isPlainObject(i)&&"destroy"in i)){o.height="auto"==o.height?f.parent().height():o.height,o.overflow=o.overflow?"hidden":"visible";var w=e(p).addClass(o.wrapperClass).css({position:"relative",overflow:o.overflow,width:o.width,height:o.height});f.css({overflow:o.overflow,width:o.width,height:o.height,"-ms-touch-action":"none"});var m=e(p).addClass(o.railClass).css({width:o.size,height:"100%",position:"absolute",top:0,display:o.alwaysVisible&&o.railVisible?"block":"none","border-radius":o.railBorderRadius,background:o.railColor,opacity:o.railOpacity,zIndex:90}),y=e(p).addClass(o.barClass).css({background:o.color,width:o.size,position:"absolute",top:0,opacity:o.opacity,display:o.alwaysVisible?"block":"none","border-radius":o.borderRadius,BorderRadius:o.borderRadius,MozBorderRadius:o.borderRadius,WebkitBorderRadius:o.borderRadius,zIndex:99}),E="right"==o.position?{right:o.distance}:{left:o.distance};m.css(E),y.css(E),f.wrap(w),f.parent().append(y),f.parent().append(m),o.railDraggable&&y.bind("mousedown",function(i){var o=e(document);return s=!0,t=parseFloat(y.css("top")),pageY=i.pageY,o.bind("mousemove.slimscroll",function(e){currTop=t+e.pageY-pageY,y.css("top",currTop),x(0,y.position().top,!1)}),o.bind("mouseup.slimscroll",function(e){s=!1,T(),o.unbind(".slimscroll")}),!1}).bind("selectstart.slimscroll",function(e){return e.stopPropagation(),e.preventDefault(),!1}),m.hover(function(){H()},function(){T()}),y.hover(function(){r=!0},function(){r=!1}),f.hover(function(){a=!0,H(),T()},function(){a=!1,T()}),window.navigator.msPointerEnabled?(f.bind("MSPointerDown",function(e,t){e.originalEvent.targetTouches.length&&(n=e.originalEvent.targetTouches[0].pageY)}),f.bind("MSPointerMove",function(e){(e.originalEvent.preventDefault(),e.originalEvent.targetTouches.length)&&(x((n-e.originalEvent.targetTouches[0].pageY)/o.touchScrollStep,!0),n=e.originalEvent.targetTouches[0].pageY)})):(f.bind("touchstart",function(e){e.cancelable&&e.originalEvent.touches.length&&(n=e.originalEvent.touches[0].pageY)}),f.bind("touchmove",function(e){e.cancelable&&(g||e.originalEvent.preventDefault(),e.originalEvent.touches.length&&(x((n-e.originalEvent.touches[0].pageY)/o.touchScrollStep,!0),n=e.originalEvent.touches[0].pageY))})),C(),"bottom"===o.start?(y.css({top:f.outerHeight()-y.outerHeight()}),x(0,!0)):"top"!==o.start&&(x(e(o.start).position().top,null,!0),o.alwaysVisible||y.hide()),function(){window.addEventListener?(this.addEventListener("DOMMouseScroll",S,{passive:!1}),this.addEventListener("mousewheel",S,{passive:!1})):document.attachEvent("onmousewheel",S)}()}function S(t){if(a){var i=0;(t=t||window.event).wheelDelta&&(i=-t.wheelDelta/120),t.detail&&(i=t.detail/3);var r=t.target||t.srcTarget||t.srcElement;e(r).closest("."+o.wrapperClass).is(f.parent())&&x(i,!0),t.preventDefault&&!g&&t.preventDefault(),g||(t.returnValue=!1)}}function x(e,t,i){g=!1;var a=e,r=f.outerHeight()-y.outerHeight();if(t&&(a=parseInt(y.css("top"))+e*parseInt(o.wheelStep)/100*y.outerHeight(),a=Math.min(Math.max(a,0),r),a=e>0?Math.ceil(a):Math.floor(a),y.css({top:a+"px"})),a=(h=parseInt(y.css("top"))/(f.outerHeight()-y.outerHeight()))*(f[0].scrollHeight-f.outerHeight()),i){var s=(a=e)/f[0].scrollHeight*f.outerHeight();s=Math.min(Math.max(s,0),r),y.css({top:s+"px"})}f.scrollTop(a),f.trigger("slimscrolling",~~a),H(),T()}function C(){c=Math.max(f.outerHeight()/f[0].scrollHeight*f.outerHeight(),d),y.css({height:c+"px"});var e=c==f.outerHeight()?"none":"block";y.css({display:e})}function H(){if(C(),clearTimeout(l),h==~~h){if(g=o.allowPageScroll,u!=h){var e=0==~~h?"top":"bottom";f.trigger("slimscroll",e)}}else g=!1;u=h,c>=f.outerHeight()?g=!0:(y.stop(!0,!0).fadeIn("fast"),o.railVisible&&m.stop(!0,!0).fadeIn("fast"))}function T(){o.alwaysVisible||(l=setTimeout(function(){o.disableFadeOut&&a||r||s||(y.fadeOut("slow"),m.fadeOut("slow"))},1e3))}}),this}}),e.fn.extend({slimscroll:e.fn.slimScroll})}(jQuery);
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。