Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

border radius compat fix

  • Loading branch information...
commit 8434879d35c7864d07abc966d779e5fa545cf050 1 parent 18e5234
Jonathan Azoff authored
Showing with 14 additions and 15 deletions.
  1. +1 −1  demo.html
  2. +10 −11 jquery.overscroll.js
  3. +3 −3 jquery.overscroll.min.js
View
2  demo.html
@@ -230,7 +230,7 @@
o = $("#overscroll").overscroll({
cancelOn: '.no-drag',
//hoverThumbs: true,
- // persistThumbs: true,
+ persistThumbs: true,
//showThumbs: false,
scrollLeft: 200,
scrollTop: 100
View
21 jquery.overscroll.js
@@ -126,12 +126,12 @@
if (thumbs.horizontal) {
ml = left * (1 + sizing.container.width / sizing.container.scrollWidth);
mt = top + sizing.thumbs.horizontal.top;
- thumbs.horizontal.css("margin", mt + "px 0 0 " + ml + "px");
+ thumbs.horizontal.css('margin', mt + 'px 0 0 ' + ml + 'px');
}
if (thumbs.vertical) {
ml = left + sizing.thumbs.vertical.left;
mt = top * (1 + sizing.container.height / sizing.container.scrollHeight);
- thumbs.vertical.css("margin", mt + "px 0 0 " + ml + "px");
+ thumbs.vertical.css('margin', mt + 'px 0 0 ' + ml + 'px');
}
}
@@ -521,17 +521,16 @@
// Genterates CSS specific to a particular thumb.
// It requires sizing data and options
getThumbCss = function(size, options) {
- var css = {
- position: "absolute",
+ return {
+ position: 'absolute',
opacity: options.persistThumbs ? settings.thumbOpacity : 0,
- "background-color": "black",
- width: size.width + "px",
- height: size.height + "px",
- "margin": size.top + "px 0 0 " + size.left + "px",
- "z-index": options.zIndex
+ 'background-color': 'black',
+ width: size.width + 'px',
+ height: size.height + 'px',
+ 'border-radius': size.corner + 'px',
+ 'margin': size.top + 'px 0 0 ' + size.left + 'px',
+ 'z-index': options.zIndex
};
- css[prefix + 'border-radius'] = size.corner + "px";
- return css;
},
// Creates the DOM elements used as "thumbs" within
View
6 jquery.overscroll.min.js
@@ -25,8 +25,8 @@ b.data,c=a.options,e=a.sizing,d=a.thumbs,f=a.position,g=a.flags;g.dragged||q(d,c
D=h.driftDecay;if(d>h.driftTimeout)return c(e);d=j.scrollDelta*(a.pageX-i.x);a=j.scrollDelta*(a.pageY-i.y);if(j.direction!=="vertical")v-=d;if(j.direction!=="horizontal")w-=a;f=d/h.driftSequences;g=a/h.driftSequences;t("driftstart",e.target);e.drifting=true;A(function P(){if(e.drifting){e.drifting=false;if(g>1&&b.scrollTop>w||g<-1&&b.scrollTop<w){e.drifting=true;b.scrollTop-=g;g/=D}if(f>1&&b.scrollLeft>v||f<-1&&b.scrollLeft<v){e.drifting=true;b.scrollLeft-=f;f/=D}p(O,N,b.scrollLeft,b.scrollTop);A(P)}else{t("driftend",
e.target);c(e)}})},E=function(b){b.preventDefault();var a=b.data,c=a.target,e=a.start=k(b.target),d=a.flags;d.drifting=false;if(!e.is(a.options.cancelOn)){c.css("cursor",s.cursorGrabbing);d.dragging=d.dragged=false;c.on(l.drag,a,C);a.position=u(b,{});a.capture=u(b,{},h.captureThreshold);t("dragstart",c)}},F=function(b){var a=b.data,c=a.target,e=a.options,d=a.flags,f=a.thumbs,g=function(){f&&!e.hoverThumbs&&q(f,e,false)};c.unbind(l.drag,C);if(a.position){t("dragend",c);d.dragging?Q(this,b,g):g()}d.dragging&&
a.start.is(b.target)&&K(a.start);a.start=a.capture=a.position=d.dragged=d.dragging=false;c.css("cursor",s.cursorGrab)},x=function(b,a){var c=k(b),e,d=c.data("overscroll")||{},f=c.attr("style"),g=a?function(){d=c.data("overscroll");e=d.thumbs;f?c.attr("style",f):c.removeAttr("style");if(e){e.horizontal&&e.horizontal.remove();e.vertical&&e.vertical.remove()}c.removeData("overscroll").off(l.wheel,B).off(l.start,E).off(l.end,F).off(l.ignored,false)}:k.noop;return k.isFunction(d.remover)?d.remover:g},
-G=function(b,a){var c={position:"absolute",opacity:a.persistThumbs?h.thumbOpacity:0,"background-color":"black",width:b.width+"px",height:b.height+"px",margin:b.top+"px 0 0 "+b.left+"px","z-index":a.zIndex};c[n+"border-radius"]=b.corner+"px";return c};m=function(b){return this.removeOverscroll().each(function(){var a=this,c=b,e;c=c;c=k.extend({},J,c);if(c.direction!=="multi"&&c.direction!==c.wheelDirection)c.wheelDirection=c.direction;c.scrollDelta=r.abs(c.scrollDelta);c.wheelDelta=r.abs(c.wheelDelta);
-c.scrollLeft=c.scrollLeft===z?null:r.abs(c.scrollLeft);c.scrollTop=c.scrollTop===z?null:r.abs(c.scrollTop);e=c=c;var d=x(a,true),f=a,g=k(f),i=g.width();g=g.height();var j=i>=f.scrollWidth?i:f.scrollWidth;f=g>=f.scrollHeight?g:f.scrollHeight;d={flags:{dragging:false},options:e,remover:d,sizing:e={container:{width:i,height:g,scrollWidth:j,scrollHeight:f},thumbs:{horizontal:{width:i*i/j,height:h.thumbThickness,corner:h.thumbThickness/2,left:0,top:g-h.thumbThickness},vertical:{width:h.thumbThickness,
-height:g*g/f,corner:h.thumbThickness/2,left:i-h.thumbThickness,top:0}}}};d.target=a=k(a).css({position:"relative",overflow:"hidden",cursor:s.cursorGrab}).on(l.wheel,d,B).on(l.start,d,E).on(l.end,d,F).on(l.scroll,d,M).on(l.ignored,false);c.scrollLeft!==null&&a.scrollLeft(c.scrollLeft);c.scrollTop!==null&&a.scrollTop(c.scrollTop);if(c.showThumbs){i=a;f=c;g={};j=false;if(e.container.scrollWidth>0&&f.direction!=="vertical"){j=G(e.thumbs.horizontal,f);g.horizontal=k("<div/>").css(j).prependTo(i)}if(e.container.scrollHeight>
+G=function(b,a){return{position:"absolute",opacity:a.persistThumbs?h.thumbOpacity:0,"background-color":"black",width:b.width+"px",height:b.height+"px","border-radius":b.corner+"px",margin:b.top+"px 0 0 "+b.left+"px","z-index":a.zIndex}};m=function(b){return this.removeOverscroll().each(function(){var a=this,c=b,e;c=c;c=k.extend({},J,c);if(c.direction!=="multi"&&c.direction!==c.wheelDirection)c.wheelDirection=c.direction;c.scrollDelta=r.abs(c.scrollDelta);c.wheelDelta=r.abs(c.wheelDelta);c.scrollLeft=
+c.scrollLeft===z?null:r.abs(c.scrollLeft);c.scrollTop=c.scrollTop===z?null:r.abs(c.scrollTop);e=c=c;var d=x(a,true),f=a,g=k(f),i=g.width();g=g.height();var j=i>=f.scrollWidth?i:f.scrollWidth;f=g>=f.scrollHeight?g:f.scrollHeight;d={flags:{dragging:false},options:e,remover:d,sizing:e={container:{width:i,height:g,scrollWidth:j,scrollHeight:f},thumbs:{horizontal:{width:i*i/j,height:h.thumbThickness,corner:h.thumbThickness/2,left:0,top:g-h.thumbThickness},vertical:{width:h.thumbThickness,height:g*g/f,
+corner:h.thumbThickness/2,left:i-h.thumbThickness,top:0}}}};d.target=a=k(a).css({position:"relative",overflow:"hidden",cursor:s.cursorGrab}).on(l.wheel,d,B).on(l.start,d,E).on(l.end,d,F).on(l.scroll,d,M).on(l.ignored,false);c.scrollLeft!==null&&a.scrollLeft(c.scrollLeft);c.scrollTop!==null&&a.scrollTop(c.scrollTop);if(c.showThumbs){i=a;f=c;g={};j=false;if(e.container.scrollWidth>0&&f.direction!=="vertical"){j=G(e.thumbs.horizontal,f);g.horizontal=k("<div/>").css(j).prependTo(i)}if(e.container.scrollHeight>
0&&f.direction!=="horizontal"){j=G(e.thumbs.vertical,f);g.vertical=k("<div/>").css(j).prependTo(i)}g.added=!!j;d.thumbs=g;if(g.added){p(g,e,a.scrollLeft(),a.scrollTop());c.hoverThumbs&&a.on(l.hover,d,L)}}a.data("overscroll",d)})};var R=function(){return this.removeOverscroll().each(function(){k(this).data("overscroll",{remover:x(this)}).css(n+"overflow-scrolling","touch").css("overflow","auto")})};m.settings=h;k.extend(I,{overscroll:s.touchEnabled?R:m,removeOverscroll:function(){return this.each(function(){x(this)()})}})})(window,
Math,setTimeout,clearTimeout,jQuery.browser,jQuery.fn,jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.