Comparing version 1.0.3 to 1.1.0
18
baron.js
@@ -17,3 +17,3 @@ (function(window, undefined) { | ||
client: 'clientHeight', crossClient: 'clientWidth', | ||
crossScroll: 'scrollLeft', | ||
scrollEdge: 'scrollLeft', | ||
offset: 'offsetHeight', crossOffset: 'offsetWidth', offsetPos: 'offsetTop', | ||
@@ -27,3 +27,3 @@ scroll: 'scrollTop', scrollSize: 'scrollHeight' | ||
client: 'clientWidth', crossClient: 'clientHeight', | ||
crossScroll: 'scrollTop', | ||
scrollEdge: 'scrollTop', | ||
offset: 'offsetWidth', crossOffset: 'offsetHeight', offsetPos: 'offsetLeft', | ||
@@ -331,2 +331,7 @@ scroll: 'scrollLeft', scrollSize: 'scrollWidth' | ||
out.scrollEdge = 0; | ||
if (params.rtl) { | ||
out.scrollEdge = out.clipper[out.origin.scrollEdge]; // initial position | ||
} | ||
return out; | ||
@@ -683,7 +688,6 @@ } | ||
this.clipperOnScroll = function() { | ||
var scrollEdge = this.origin.crossScroll; | ||
if (this.direction == 'h') return; | ||
if (this.clipper[scrollEdge]) { | ||
this.clipper[scrollEdge] = 0; | ||
} | ||
// clipper.scrollLeft = initial scroll position (0 for ltr, 17 for rtl) | ||
this.clipper[this.origin.scrollEdge] = this.scrollEdge; | ||
}; | ||
@@ -783,3 +787,3 @@ | ||
baron.version = '1.0.0'; | ||
baron.version = '1.1.0'; | ||
@@ -786,0 +790,0 @@ if ($ && $.fn) { // Adding baron to jQuery as plugin |
@@ -1,1 +0,1 @@ | ||
!function(t,i){"use strict";function s(e){var r,o,n=!e,l={$:t.jQuery,direction:"v",barOnCls:"baron",resizeDebounce:0,event:function(t,i,s,r){e.$(t)[r||"on"](i,s)},cssGuru:!1};e=e||{};for(var c in l)e[c]===i&&(e[c]=l[c]);r=this instanceof e.$,r?e.root=o=this:o=e.$(e.root||e.scroller);var a=new s.fn.constructor(o,e,n);return a.autoUpdate&&!n&&a.autoUpdate(),a}function e(s,e){var r=0;for((s.length===i||s===t)&&(s=[s]);s[r];)e.call(this,s[r],r),r++}function r(){return(new Date).getTime()}function o(i,s,r){i._eventHandlers=i._eventHandlers||[{element:i.scroller,handler:function(t){i.scroll(t)},type:"scroll"},{element:i.root,handler:function(){i.update()},type:"transitionend animationend"},{element:i.scroller,handler:function(){i.update()},type:"keyup"},{element:i.bar,handler:function(t){t.preventDefault(),i.selection(),i.drag.now=1,i.draggingCls&&h(i.bar).addClass(i.draggingCls)},type:"touchstart mousedown"},{element:document,handler:function(){i.selection(1),i.drag.now=0,i.draggingCls&&h(i.bar).removeClass(i.draggingCls)},type:"mouseup blur touchend"},{element:document,handler:function(t){2!=t.button&&i._pos0(t)},type:"touchstart mousedown"},{element:document,handler:function(t){i.drag.now&&i.drag(t)},type:"mousemove touchmove"},{element:t,handler:function(){i.update()},type:"resize"},{element:i.root,handler:function(){i.update()},type:"sizeChange"},{element:i.clipper,handler:function(){i.clipperOnScroll()},type:"scroll"}],e(i._eventHandlers,function(t){t.element&&s(t.element,t.type,t.handler,r)})}function n(t,i,s,e){var r="data-baron-"+i+"-id";if("on"==s)t.setAttribute(r,e);else{if("off"!=s)return t.getAttribute(r);t.removeAttribute(r)}}function l(t){n(t.root,t.direction)&&console.log("Error! Baron for this node already initialized",t.root);var i=new v.prototype.constructor(t);return o(i,t.event,"on"),n(i.root,t.direction,"on",p.length),p.push(i),i.update(),i}function c(t){var i={};t=t||{};for(var s in t)t.hasOwnProperty(s)&&(i[s]=t[s]);return i}function a(t){if(this.events&&this.events[t])for(var i=0;i<this.events[t].length;i++){var s=Array.prototype.slice.call(arguments,1);this.events[t][i].apply(this,s)}}if(t){var h=t.$,u=s,f=["left","top","right","bottom","width","height"],p=[],d={v:{x:"Y",pos:f[1],oppos:f[3],crossPos:f[0],crossOpPos:f[2],size:f[5],crossSize:f[4],crossMinSize:"min-"+f[4],crossMaxSize:"max-"+f[4],client:"clientHeight",crossClient:"clientWidth",crossScroll:"scrollLeft",offset:"offsetHeight",crossOffset:"offsetWidth",offsetPos:"offsetTop",scroll:"scrollTop",scrollSize:"scrollHeight"},h:{x:"X",pos:f[0],oppos:f[2],crossPos:f[1],crossOpPos:f[3],size:f[4],crossSize:f[5],crossMinSize:"min-"+f[5],crossMaxSize:"max-"+f[5],client:"clientWidth",crossClient:"clientHeight",crossScroll:"scrollTop",offset:"offsetWidth",crossOffset:"offsetHeight",offsetPos:"offsetLeft",scroll:"scrollLeft",scrollSize:"scrollWidth"}};s._instances=p,s.fn={constructor:function(t,s,r){var o=c(s);o.event=function(t,i,r,o){e(t,function(t){s.event(t,i,r,o)})},this.length=0,e.call(this,t,function(t,s){var e=n(t,o.direction),a=+e;if(a==a&&e!=i&&p[a]&&r)this[s]=p[a];else{var h=c(o);o.root&&o.scroller?(h.scroller=o.$(o.scroller,t),h.scroller.length||(h.scroller=t)):h.scroller=t,h.root=t,this[s]=l(h)}this.length=s+1}),this.params=o},dispose:function(){var t=this.params;e(this,function(i){i.dispose(t)}),this.params=null},update:function(){for(var t=0;this[t];)this[t].update.apply(this[t],arguments),t++},baron:function(t){return t.root=[],t.scroller=this.params.scroller,e.call(this,this,function(i){t.root.push(i.root)}),t.direction="v"==this.params.direction?"h":"v",t._chain=!0,s(t)}};var v={};v.prototype={_debounce:function(t,s){var e,o,n=this,l=function(){if(n._disposed)return clearTimeout(e),e=n=null,i;var c=r()-o;s>c&&c>=0?e=setTimeout(l,s-c):(e=null,t())};return function(){o=r(),e||(e=setTimeout(l,s))}},constructor:function(t){function s(t,i){return u(t,i)[0]}function e(t){var i=this.barMinSize||20;t>0&&i>t&&(t=i),this.bar&&u(this.bar).css(this.origin.size,parseInt(t,10)+"px")}function o(t){if(this.bar){var i=u(this.bar).css(this.origin.pos),s=+t+"px";s&&s!=i&&u(this.bar).css(this.origin.pos,s)}}function n(){return v[this.origin.client]-this.barTopLimit-this.bar[this.origin.offset]}function l(t){return t*n.call(this)+this.barTopLimit}function c(t){return(t-this.barTopLimit)/n.call(this)}function h(){return!1}var u,f,p,v,g,m,b,C,z;return C=b=r(),u=this.$=t.$,this.event=t.event,this.events={},this.root=t.root,this.scroller=s(t.scroller),this.bar=s(t.bar,this.root),v=this.track=s(t.track,this.root),!this.track&&this.bar&&(v=this.bar.parentNode),this.clipper=this.scroller.parentNode,this.direction=t.direction,this.origin=d[this.direction],this.barOnCls=t.barOnCls||"_baron",this.scrollingCls=t.scrollingCls,this.draggingCls=t.draggingCls,this.impact=t.impact,this.barTopLimit=0,this.resizeDebounce=t.resizeDebounce,this.cursor=function(t){return t["client"+this.origin.x]||(((t.originalEvent||t).touches||{})[0]||{})["page"+this.origin.x]},this.pos=function(t){var s="page"+this.origin.x+"Offset",e=this.scroller[s]?s:this.origin.scroll;return t!==i&&(this.scroller[e]=t),this.scroller[e]},this.rpos=function(t){var i,s=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];return i=t?this.pos(t*s):this.pos(),i/(s||1)},this.barOn=function(t){this.barOnCls&&(t||this.scroller[this.origin.client]>=this.scroller[this.origin.scrollSize]?u(this.root).hasClass(this.barOnCls)&&u(this.root).removeClass(this.barOnCls):u(this.root).hasClass(this.barOnCls)||u(this.root).addClass(this.barOnCls))},this._pos0=function(t){p=this.cursor(t)-f},this.drag=function(t){var i=c.call(this,this.cursor(t)-p),s=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];this.scroller[this.origin.scroll]=i*s},this.selection=function(t){this.event(document,"selectpos selectstart",h,t?"off":"on")},this.resize=function(){function t(){var t,i,e=s.scroller[s.origin.crossOffset],o=s.scroller[s.origin.crossClient];if(o>0&&0===e&&(e=o+17),e){s.barOn(),o=s.scroller[s.origin.crossClient];var n=s.impact?"scroller"==s.impact:"v"==s.direction;if(n){var l=e-o;t=u(s.clipper).css(s.origin.crossSize),i=s.clipper[s.origin.crossClient]+l+"px",t!=i&&s._setCrossSizes(s.scroller,i)}else t=u(s.clipper).css(s.origin.crossSize),i=o+"px",t!=i&&s._setCrossSizes(s.clipper,i)}Array.prototype.unshift.call(arguments,"resize"),a.apply(s,arguments),C=r()}var s=this,e=s.resizeDebounce===i?300:s.resizeDebounce,o=0;r()-C<e&&(clearTimeout(g),o=e),o?g=setTimeout(t,o):t()},this.updatePositions=function(){var t,i=this;i.bar&&(t=(v[i.origin.client]-i.barTopLimit)*i.scroller[i.origin.client]/i.scroller[i.origin.scrollSize],parseInt(z,10)!=parseInt(t,10)&&(e.call(i,t),z=t),f=l.call(i,i.rpos()),o.call(i,f)),Array.prototype.unshift.call(arguments,"scroll"),a.apply(i,arguments),b=r()},this.scroll=function(){var t=this;t.updatePositions(),t.scrollingCls&&(m||t.$(t.scroller).addClass(t.scrollingCls),clearTimeout(m),m=setTimeout(function(){t.$(t.scroller).removeClass(t.scrollingCls),m=i},300))},this.clipperOnScroll=function(){var t=this.origin.crossScroll;this.clipper[t]&&(this.clipper[t]=0)},this._setCrossSizes=function(t,i){var s={};s[this.origin.crossSize]=i,s[this.origin.crossMinSize]=i,s[this.origin.crossMaxSize]=i,this.$(t).css(s)},this._dumbCss=function(i){if(!t.cssGuru){var s=i?"hidden":null,e=i?"none":null;this.$(this.clipper).css({overflow:s,msOverflowStyle:e});var r=i?"scroll":null,o="v"==this.direction?"y":"x",n={};n["overflow-"+o]=r,n["box-sizing"]="border-box",n.margin="0",n.border="0",this.$(this.scroller).css(n)}},this},update:function(t){return a.call(this,"upd",t),this._dumbCss(!0),this.resize(1),this.updatePositions(),this},dispose:function(t){o(this,this.event,"off"),n(this.root,t.direction,"off"),"v"==t.direction?this._setCrossSizes(this.scroller,""):this._setCrossSizes(this.clipper,""),this._dumbCss(!1),this.barOn(!0),a.call(this,"dispose"),this._disposed=!0},on:function(t,i,s){for(var e=t.split(" "),r=0;r<e.length;r++)"init"==e[r]?i.call(this,s):(this.events[e[r]]=this.events[e[r]]||[],this.events[e[r]].push(function(t){i.call(this,t||s)}))}},s.fn.constructor.prototype=s.fn,v.prototype.constructor.prototype=v.prototype,s.noConflict=function(){return t.baron=u,s},s.version="1.0.0",h&&h.fn&&(h.fn.baron=s),t.baron=s,"undefined"!=typeof module&&(module.exports=s.noConflict())}}(window),function(t,s){var e=function(t){function e(t,i,e){var r=1==e?"pos":"oppos";l<(c.minView||0)&&(i=s),this.$(n[t]).css(this.origin.pos,"").css(this.origin.oppos,"").removeClass(c.outside),i!==s&&(i+="px",this.$(n[t]).css(this.origin[r],i).addClass(c.outside))}function r(t){try{i=document.createEvent("WheelEvent"),i.initWebKitWheelEvent(t.originalEvent.wheelDeltaX,t.originalEvent.wheelDeltaY),f.dispatchEvent(i),t.preventDefault()}catch(t){}}function o(t){var i;for(var s in t)c[s]=t[s];if(n=this.$(c.elements,this.scroller)){l=this.scroller[this.origin.client];for(var e=0;e<n.length;e++)i={},i[this.origin.size]=n[e][this.origin.offset],n[e].parentNode!==this.scroller&&this.$(n[e].parentNode).css(i),i={},i[this.origin.crossSize]=n[e].parentNode[this.origin.crossClient],this.$(n[e]).css(i),l-=n[e][this.origin.offset],u[e]=n[e].parentNode[this.origin.offsetPos],a[e]=a[e-1]||0,h[e]=h[e-1]||Math.min(u[e],0),n[e-1]&&(a[e]+=n[e-1][this.origin.offset],h[e]+=n[e-1][this.origin.offset]),(0!=e||0!=u[e])&&(this.event(n[e],"mousewheel",r,"off"),this.event(n[e],"mousewheel",r));c.limiter&&n[0]&&(this.track&&this.track!=this.scroller?(i={},i[this.origin.pos]=n[0].parentNode[this.origin.offset],this.$(this.track).css(i)):this.barTopLimit=n[0].parentNode[this.origin.offset],this.scroll()),c.limiter===!1&&(this.barTopLimit=0)}var o={element:n,handler:function(){for(var t,i=d(this)[0].parentNode,s=i.offsetTop,e=0;e<n.length;e++)n[e]===this&&(t=e);var r=s-a[t];c.scroll?c.scroll({x1:v.scroller.scrollTop,x2:r}):v.scroller.scrollTop=r},type:"click"};c.clickable&&(this._eventHandlers.push(o),p(o.element,o.type,o.handler,"on"))}var n,l,c={outside:"",inside:"",before:"",after:"",past:"",future:"",radius:0,minView:0},a=[],h=[],u=[],f=this.scroller,p=this.event,d=this.$,v=this;this.on("init",o,t);var g=[],m=[];this.on("init scroll",function(){var t,i,r;if(n){for(var o,f=0;f<n.length;f++)t=0,u[f]-this.pos()<h[f]+c.radius?(t=1,i=a[f]):u[f]-this.pos()>h[f]+l-c.radius?(t=2,i=this.scroller[this.origin.client]-n[f][this.origin.offset]-a[f]-l):(t=3,i=s),r=!1,(u[f]-this.pos()<h[f]||u[f]-this.pos()>h[f]+l)&&(r=!0),(t!=g[f]||r!=m[f])&&(e.call(this,f,i,t),g[f]=t,m[f]=r,o=!0);if(o)for(f=0;f<n.length;f++)1==g[f]&&c.past&&this.$(n[f]).addClass(c.past).removeClass(c.future),2==g[f]&&c.future&&this.$(n[f]).addClass(c.future).removeClass(c.past),3==g[f]?((c.future||c.past)&&this.$(n[f]).removeClass(c.past).removeClass(c.future),c.inside&&this.$(n[f]).addClass(c.inside)):c.inside&&this.$(n[f]).removeClass(c.inside),g[f]!=g[f+1]&&1==g[f]&&c.before?this.$(n[f]).addClass(c.before).removeClass(c.after):g[f]!=g[f-1]&&2==g[f]&&c.after?this.$(n[f]).addClass(c.after).removeClass(c.before):this.$(n[f]).removeClass(c.before).removeClass(c.after),c.grad&&(m[f]?this.$(n[f]).addClass(c.grad):this.$(n[f]).removeClass(c.grad))}}),this.on("resize upd",function(t){o.call(this,t&&t.fix)})};baron.fn.fix=function(t){for(var i=0;this[i];)e.call(this[i],t),i++;return this}}(window),function(t){var i=t.MutationObserver||t.WebKitMutationObserver||t.MozMutationObserver||null,s=function(){function t(){o.root[o.origin.offset]?e():s()}function s(){r||(r=setInterval(function(){o.root[o.origin.offset]&&(e(),o.update())},300))}function e(){clearInterval(r),r=null}var r,o=this,n=o._debounce(function(){o.update()},300);this._observer=new i(function(){t(),o.update(),n()}),this.on("init",function(){o._observer.observe(o.root,{childList:!0,subtree:!0,characterData:!0}),t()}),this.on("dispose",function(){o._observer.disconnect(),e(),delete o._observer})};baron.fn.autoUpdate=function(t){if(!i)return this;for(var e=0;this[e];)s.call(this[e],t),e++;return this}}(window),function(t,i){var s=function(t){var i,s,e,r,o,n=this;r=t.screen||.9,t.forward&&(i=this.$(t.forward,this.clipper),o={element:i,handler:function(){var i=n.pos()-t.delta||30;n.pos(i)},type:"click"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")),t.backward&&(s=this.$(t.backward,this.clipper),o={element:s,handler:function(){var i=n.pos()+t.delta||30;n.pos(i)},type:"click"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")),t.track&&(e=t.track===!0?this.track:this.$(t.track,this.clipper)[0],e&&(o={element:e,handler:function(t){var i=t["offset"+n.origin.x],s=n.bar[n.origin.offsetPos],e=0;s>i?e=-1:i>s+n.bar[n.origin.offset]&&(e=1);var o=n.pos()+e*r*n.scroller[n.origin.client];n.pos(o)},type:"mousedown"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")))};baron.fn.controls=function(t){for(var i=0;this[i];)s.call(this[i],t),i++;return this}}(window),function(t,i){var s=function(t){function i(){return m.scroller[m.origin.scroll]+m.scroller[m.origin.offset]}function s(){return m.scroller[m.origin.scrollSize]}function e(){return m.scroller[m.origin.client]}function r(t,i){var s=5e-4*t;return Math.floor(i-s*(t+550))}function o(t){h=t,t?(n(),l=setInterval(n,200)):clearInterval(l)}function n(){var n,l,h={},w=i(),$=s(),S=1==b;if(l=0,b>0&&(l=40),n=r(z,l),w>=$-z&&b>-1?S&&(z+=n):z=0,0>z&&(z=0),h[f]=z+"px",e()<=s()){m.$(u).css(h);for(var _=0;_<v.length;_++)m.$(v[_].self).css(v[_].property,Math.min(z/p*100,100)+"%")}g&&z&&m.$(m.root).addClass(g),0==z&&t.onCollapse&&t.onCollapse(),b=0,c=setTimeout(function(){b=-1},y),d&&z>p&&!a&&(d(),a=!0),0==z?C++:C=0,C>1&&(o(!1),a=!1,g&&m.$(m.root).removeClass(g))}var l,c,a,h,u=this.$(t.block),f=t.size||this.origin.size,p=t.limit||80,d=t.onExpand,v=t.elements||[],g=t.inProgress||"",m=this,b=0,C=0,z=0,y=t.waiting||500;this.on("init",function(){o(!0)}),this.on("dispose",function(){o(!1)}),this.event(this.scroller,"mousewheel DOMMouseScroll",function(t){var e=t.wheelDelta<0||t.originalEvent&&t.originalEvent.wheelDelta<0||t.detail>0;e&&(b=1,clearTimeout(c),!h&&i()>=s()&&o(!0))})};baron.fn.pull=function(t){for(var i=0;this[i];)s.call(this[i],t),i++;return this}}(window); | ||
!function(t,i){"use strict";function s(e){var r,o,n=!e,l={$:t.jQuery,direction:"v",barOnCls:"baron",resizeDebounce:0,event:function(t,i,s,r){e.$(t)[r||"on"](i,s)},cssGuru:!1};e=e||{};for(var c in l)e[c]===i&&(e[c]=l[c]);r=this instanceof e.$,r?e.root=o=this:o=e.$(e.root||e.scroller);var a=new s.fn.constructor(o,e,n);return a.autoUpdate&&!n&&a.autoUpdate(),a}function e(s,e){var r=0;for((s.length===i||s===t)&&(s=[s]);s[r];)e.call(this,s[r],r),r++}function r(){return(new Date).getTime()}function o(i,s,r){i._eventHandlers=i._eventHandlers||[{element:i.scroller,handler:function(t){i.scroll(t)},type:"scroll"},{element:i.root,handler:function(){i.update()},type:"transitionend animationend"},{element:i.scroller,handler:function(){i.update()},type:"keyup"},{element:i.bar,handler:function(t){t.preventDefault(),i.selection(),i.drag.now=1,i.draggingCls&&h(i.bar).addClass(i.draggingCls)},type:"touchstart mousedown"},{element:document,handler:function(){i.selection(1),i.drag.now=0,i.draggingCls&&h(i.bar).removeClass(i.draggingCls)},type:"mouseup blur touchend"},{element:document,handler:function(t){2!=t.button&&i._pos0(t)},type:"touchstart mousedown"},{element:document,handler:function(t){i.drag.now&&i.drag(t)},type:"mousemove touchmove"},{element:t,handler:function(){i.update()},type:"resize"},{element:i.root,handler:function(){i.update()},type:"sizeChange"},{element:i.clipper,handler:function(){i.clipperOnScroll()},type:"scroll"}],e(i._eventHandlers,function(t){t.element&&s(t.element,t.type,t.handler,r)})}function n(t,i,s,e){var r="data-baron-"+i+"-id";if("on"==s)t.setAttribute(r,e);else{if("off"!=s)return t.getAttribute(r);t.removeAttribute(r)}}function l(t){n(t.root,t.direction)&&console.log("Error! Baron for this node already initialized",t.root);var i=new v.prototype.constructor(t);return o(i,t.event,"on"),n(i.root,t.direction,"on",p.length),p.push(i),i.update(),i.scrollEdge=0,t.rtl&&(i.scrollEdge=i.clipper[i.origin.scrollEdge]),i}function c(t){var i={};t=t||{};for(var s in t)t.hasOwnProperty(s)&&(i[s]=t[s]);return i}function a(t){if(this.events&&this.events[t])for(var i=0;i<this.events[t].length;i++){var s=Array.prototype.slice.call(arguments,1);this.events[t][i].apply(this,s)}}if(t){var h=t.$,u=s,f=["left","top","right","bottom","width","height"],p=[],d={v:{x:"Y",pos:f[1],oppos:f[3],crossPos:f[0],crossOpPos:f[2],size:f[5],crossSize:f[4],crossMinSize:"min-"+f[4],crossMaxSize:"max-"+f[4],client:"clientHeight",crossClient:"clientWidth",scrollEdge:"scrollLeft",offset:"offsetHeight",crossOffset:"offsetWidth",offsetPos:"offsetTop",scroll:"scrollTop",scrollSize:"scrollHeight"},h:{x:"X",pos:f[0],oppos:f[2],crossPos:f[1],crossOpPos:f[3],size:f[4],crossSize:f[5],crossMinSize:"min-"+f[5],crossMaxSize:"max-"+f[5],client:"clientWidth",crossClient:"clientHeight",scrollEdge:"scrollTop",offset:"offsetWidth",crossOffset:"offsetHeight",offsetPos:"offsetLeft",scroll:"scrollLeft",scrollSize:"scrollWidth"}};s._instances=p,s.fn={constructor:function(t,s,r){var o=c(s);o.event=function(t,i,r,o){e(t,function(t){s.event(t,i,r,o)})},this.length=0,e.call(this,t,function(t,s){var e=n(t,o.direction),a=+e;if(a==a&&e!=i&&p[a]&&r)this[s]=p[a];else{var h=c(o);o.root&&o.scroller?(h.scroller=o.$(o.scroller,t),h.scroller.length||(h.scroller=t)):h.scroller=t,h.root=t,this[s]=l(h)}this.length=s+1}),this.params=o},dispose:function(){var t=this.params;e(this,function(i){i.dispose(t)}),this.params=null},update:function(){for(var t=0;this[t];)this[t].update.apply(this[t],arguments),t++},baron:function(t){return t.root=[],t.scroller=this.params.scroller,e.call(this,this,function(i){t.root.push(i.root)}),t.direction="v"==this.params.direction?"h":"v",t._chain=!0,s(t)}};var v={};v.prototype={_debounce:function(t,s){var e,o,n=this,l=function(){if(n._disposed)return clearTimeout(e),e=n=null,i;var c=r()-o;s>c&&c>=0?e=setTimeout(l,s-c):(e=null,t())};return function(){o=r(),e||(e=setTimeout(l,s))}},constructor:function(t){function s(t,i){return u(t,i)[0]}function e(t){var i=this.barMinSize||20;t>0&&i>t&&(t=i),this.bar&&u(this.bar).css(this.origin.size,parseInt(t,10)+"px")}function o(t){if(this.bar){var i=u(this.bar).css(this.origin.pos),s=+t+"px";s&&s!=i&&u(this.bar).css(this.origin.pos,s)}}function n(){return v[this.origin.client]-this.barTopLimit-this.bar[this.origin.offset]}function l(t){return t*n.call(this)+this.barTopLimit}function c(t){return(t-this.barTopLimit)/n.call(this)}function h(){return!1}var u,f,p,v,g,m,b,C,z;return C=b=r(),u=this.$=t.$,this.event=t.event,this.events={},this.root=t.root,this.scroller=s(t.scroller),this.bar=s(t.bar,this.root),v=this.track=s(t.track,this.root),!this.track&&this.bar&&(v=this.bar.parentNode),this.clipper=this.scroller.parentNode,this.direction=t.direction,this.origin=d[this.direction],this.barOnCls=t.barOnCls||"_baron",this.scrollingCls=t.scrollingCls,this.draggingCls=t.draggingCls,this.impact=t.impact,this.barTopLimit=0,this.resizeDebounce=t.resizeDebounce,this.cursor=function(t){return t["client"+this.origin.x]||(((t.originalEvent||t).touches||{})[0]||{})["page"+this.origin.x]},this.pos=function(t){var s="page"+this.origin.x+"Offset",e=this.scroller[s]?s:this.origin.scroll;return t!==i&&(this.scroller[e]=t),this.scroller[e]},this.rpos=function(t){var i,s=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];return i=t?this.pos(t*s):this.pos(),i/(s||1)},this.barOn=function(t){this.barOnCls&&(t||this.scroller[this.origin.client]>=this.scroller[this.origin.scrollSize]?u(this.root).hasClass(this.barOnCls)&&u(this.root).removeClass(this.barOnCls):u(this.root).hasClass(this.barOnCls)||u(this.root).addClass(this.barOnCls))},this._pos0=function(t){p=this.cursor(t)-f},this.drag=function(t){var i=c.call(this,this.cursor(t)-p),s=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];this.scroller[this.origin.scroll]=i*s},this.selection=function(t){this.event(document,"selectpos selectstart",h,t?"off":"on")},this.resize=function(){function t(){var t,i,e=s.scroller[s.origin.crossOffset],o=s.scroller[s.origin.crossClient];if(o>0&&0===e&&(e=o+17),e){s.barOn(),o=s.scroller[s.origin.crossClient];var n=s.impact?"scroller"==s.impact:"v"==s.direction;if(n){var l=e-o;t=u(s.clipper).css(s.origin.crossSize),i=s.clipper[s.origin.crossClient]+l+"px",t!=i&&s._setCrossSizes(s.scroller,i)}else t=u(s.clipper).css(s.origin.crossSize),i=o+"px",t!=i&&s._setCrossSizes(s.clipper,i)}Array.prototype.unshift.call(arguments,"resize"),a.apply(s,arguments),C=r()}var s=this,e=s.resizeDebounce===i?300:s.resizeDebounce,o=0;r()-C<e&&(clearTimeout(g),o=e),o?g=setTimeout(t,o):t()},this.updatePositions=function(){var t,i=this;i.bar&&(t=(v[i.origin.client]-i.barTopLimit)*i.scroller[i.origin.client]/i.scroller[i.origin.scrollSize],parseInt(z,10)!=parseInt(t,10)&&(e.call(i,t),z=t),f=l.call(i,i.rpos()),o.call(i,f)),Array.prototype.unshift.call(arguments,"scroll"),a.apply(i,arguments),b=r()},this.scroll=function(){var t=this;t.updatePositions(),t.scrollingCls&&(m||t.$(t.scroller).addClass(t.scrollingCls),clearTimeout(m),m=setTimeout(function(){t.$(t.scroller).removeClass(t.scrollingCls),m=i},300))},this.clipperOnScroll=function(){"h"!=this.direction&&(this.clipper[this.origin.scrollEdge]=this.scrollEdge)},this._setCrossSizes=function(t,i){var s={};s[this.origin.crossSize]=i,s[this.origin.crossMinSize]=i,s[this.origin.crossMaxSize]=i,this.$(t).css(s)},this._dumbCss=function(i){if(!t.cssGuru){var s=i?"hidden":null,e=i?"none":null;this.$(this.clipper).css({overflow:s,msOverflowStyle:e});var r=i?"scroll":null,o="v"==this.direction?"y":"x",n={};n["overflow-"+o]=r,n["box-sizing"]="border-box",n.margin="0",n.border="0",this.$(this.scroller).css(n)}},this},update:function(t){return a.call(this,"upd",t),this._dumbCss(!0),this.resize(1),this.updatePositions(),this},dispose:function(t){o(this,this.event,"off"),n(this.root,t.direction,"off"),"v"==t.direction?this._setCrossSizes(this.scroller,""):this._setCrossSizes(this.clipper,""),this._dumbCss(!1),this.barOn(!0),a.call(this,"dispose"),this._disposed=!0},on:function(t,i,s){for(var e=t.split(" "),r=0;r<e.length;r++)"init"==e[r]?i.call(this,s):(this.events[e[r]]=this.events[e[r]]||[],this.events[e[r]].push(function(t){i.call(this,t||s)}))}},s.fn.constructor.prototype=s.fn,v.prototype.constructor.prototype=v.prototype,s.noConflict=function(){return t.baron=u,s},s.version="1.1.0",h&&h.fn&&(h.fn.baron=s),t.baron=s,"undefined"!=typeof module&&(module.exports=s.noConflict())}}(window),function(t,s){var e=function(t){function e(t,i,e){var r=1==e?"pos":"oppos";l<(c.minView||0)&&(i=s),this.$(n[t]).css(this.origin.pos,"").css(this.origin.oppos,"").removeClass(c.outside),i!==s&&(i+="px",this.$(n[t]).css(this.origin[r],i).addClass(c.outside))}function r(t){try{i=document.createEvent("WheelEvent"),i.initWebKitWheelEvent(t.originalEvent.wheelDeltaX,t.originalEvent.wheelDeltaY),f.dispatchEvent(i),t.preventDefault()}catch(t){}}function o(t){var i;for(var s in t)c[s]=t[s];if(n=this.$(c.elements,this.scroller)){l=this.scroller[this.origin.client];for(var e=0;e<n.length;e++)i={},i[this.origin.size]=n[e][this.origin.offset],n[e].parentNode!==this.scroller&&this.$(n[e].parentNode).css(i),i={},i[this.origin.crossSize]=n[e].parentNode[this.origin.crossClient],this.$(n[e]).css(i),l-=n[e][this.origin.offset],u[e]=n[e].parentNode[this.origin.offsetPos],a[e]=a[e-1]||0,h[e]=h[e-1]||Math.min(u[e],0),n[e-1]&&(a[e]+=n[e-1][this.origin.offset],h[e]+=n[e-1][this.origin.offset]),(0!=e||0!=u[e])&&(this.event(n[e],"mousewheel",r,"off"),this.event(n[e],"mousewheel",r));c.limiter&&n[0]&&(this.track&&this.track!=this.scroller?(i={},i[this.origin.pos]=n[0].parentNode[this.origin.offset],this.$(this.track).css(i)):this.barTopLimit=n[0].parentNode[this.origin.offset],this.scroll()),c.limiter===!1&&(this.barTopLimit=0)}var o={element:n,handler:function(){for(var t,i=d(this)[0].parentNode,s=i.offsetTop,e=0;e<n.length;e++)n[e]===this&&(t=e);var r=s-a[t];c.scroll?c.scroll({x1:v.scroller.scrollTop,x2:r}):v.scroller.scrollTop=r},type:"click"};c.clickable&&(this._eventHandlers.push(o),p(o.element,o.type,o.handler,"on"))}var n,l,c={outside:"",inside:"",before:"",after:"",past:"",future:"",radius:0,minView:0},a=[],h=[],u=[],f=this.scroller,p=this.event,d=this.$,v=this;this.on("init",o,t);var g=[],m=[];this.on("init scroll",function(){var t,i,r;if(n){for(var o,f=0;f<n.length;f++)t=0,u[f]-this.pos()<h[f]+c.radius?(t=1,i=a[f]):u[f]-this.pos()>h[f]+l-c.radius?(t=2,i=this.scroller[this.origin.client]-n[f][this.origin.offset]-a[f]-l):(t=3,i=s),r=!1,(u[f]-this.pos()<h[f]||u[f]-this.pos()>h[f]+l)&&(r=!0),(t!=g[f]||r!=m[f])&&(e.call(this,f,i,t),g[f]=t,m[f]=r,o=!0);if(o)for(f=0;f<n.length;f++)1==g[f]&&c.past&&this.$(n[f]).addClass(c.past).removeClass(c.future),2==g[f]&&c.future&&this.$(n[f]).addClass(c.future).removeClass(c.past),3==g[f]?((c.future||c.past)&&this.$(n[f]).removeClass(c.past).removeClass(c.future),c.inside&&this.$(n[f]).addClass(c.inside)):c.inside&&this.$(n[f]).removeClass(c.inside),g[f]!=g[f+1]&&1==g[f]&&c.before?this.$(n[f]).addClass(c.before).removeClass(c.after):g[f]!=g[f-1]&&2==g[f]&&c.after?this.$(n[f]).addClass(c.after).removeClass(c.before):this.$(n[f]).removeClass(c.before).removeClass(c.after),c.grad&&(m[f]?this.$(n[f]).addClass(c.grad):this.$(n[f]).removeClass(c.grad))}}),this.on("resize upd",function(t){o.call(this,t&&t.fix)})};baron.fn.fix=function(t){for(var i=0;this[i];)e.call(this[i],t),i++;return this}}(window),function(t){var i=t.MutationObserver||t.WebKitMutationObserver||t.MozMutationObserver||null,s=function(){function t(){o.root[o.origin.offset]?e():s()}function s(){r||(r=setInterval(function(){o.root[o.origin.offset]&&(e(),o.update())},300))}function e(){clearInterval(r),r=null}var r,o=this,n=o._debounce(function(){o.update()},300);this._observer=new i(function(){t(),o.update(),n()}),this.on("init",function(){o._observer.observe(o.root,{childList:!0,subtree:!0,characterData:!0}),t()}),this.on("dispose",function(){o._observer.disconnect(),e(),delete o._observer})};baron.fn.autoUpdate=function(t){if(!i)return this;for(var e=0;this[e];)s.call(this[e],t),e++;return this}}(window),function(t,i){var s=function(t){var i,s,e,r,o,n=this;r=t.screen||.9,t.forward&&(i=this.$(t.forward,this.clipper),o={element:i,handler:function(){var i=n.pos()-t.delta||30;n.pos(i)},type:"click"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")),t.backward&&(s=this.$(t.backward,this.clipper),o={element:s,handler:function(){var i=n.pos()+t.delta||30;n.pos(i)},type:"click"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")),t.track&&(e=t.track===!0?this.track:this.$(t.track,this.clipper)[0],e&&(o={element:e,handler:function(t){var i=t["offset"+n.origin.x],s=n.bar[n.origin.offsetPos],e=0;s>i?e=-1:i>s+n.bar[n.origin.offset]&&(e=1);var o=n.pos()+e*r*n.scroller[n.origin.client];n.pos(o)},type:"mousedown"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")))};baron.fn.controls=function(t){for(var i=0;this[i];)s.call(this[i],t),i++;return this}}(window),function(t,i){var s=function(t){function i(){return m.scroller[m.origin.scroll]+m.scroller[m.origin.offset]}function s(){return m.scroller[m.origin.scrollSize]}function e(){return m.scroller[m.origin.client]}function r(t,i){var s=5e-4*t;return Math.floor(i-s*(t+550))}function o(t){h=t,t?(n(),l=setInterval(n,200)):clearInterval(l)}function n(){var n,l,h={},w=i(),$=s(),S=1==b;if(l=0,b>0&&(l=40),n=r(z,l),w>=$-z&&b>-1?S&&(z+=n):z=0,0>z&&(z=0),h[f]=z+"px",e()<=s()){m.$(u).css(h);for(var _=0;_<v.length;_++)m.$(v[_].self).css(v[_].property,Math.min(z/p*100,100)+"%")}g&&z&&m.$(m.root).addClass(g),0==z&&t.onCollapse&&t.onCollapse(),b=0,c=setTimeout(function(){b=-1},y),d&&z>p&&!a&&(d(),a=!0),0==z?C++:C=0,C>1&&(o(!1),a=!1,g&&m.$(m.root).removeClass(g))}var l,c,a,h,u=this.$(t.block),f=t.size||this.origin.size,p=t.limit||80,d=t.onExpand,v=t.elements||[],g=t.inProgress||"",m=this,b=0,C=0,z=0,y=t.waiting||500;this.on("init",function(){o(!0)}),this.on("dispose",function(){o(!1)}),this.event(this.scroller,"mousewheel DOMMouseScroll",function(t){var e=t.wheelDelta<0||t.originalEvent&&t.originalEvent.wheelDelta<0||t.detail>0;e&&(b=1,clearTimeout(c),!h&&i()>=s()&&o(!0))})};baron.fn.pull=function(t){for(var i=0;this[i];)s.call(this[i],t),i++;return this}}(window); |
@@ -0,1 +1,5 @@ | ||
## 1.1.0 | ||
- add `rtl` param. | ||
## 1.0.3 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "baron", | ||
"description": "A small, fast and crossbrowser custom scrollbar with native system scroll mechanic.", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"readmeFilename": "README.md", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/Diokuz/baron", |
230
readme.md
@@ -7,5 +7,5 @@ [![Build Status](https://travis-ci.org/Diokuz/baron.svg)](https://travis-ci.org/Diokuz/baron) | ||
## Demo | ||
## [Demo](http://diokuz.github.io/baron/) | ||
http://diokuz.github.io/baron/ | ||
## [API](docs/api.md) | ||
@@ -24,5 +24,17 @@ ## Features | ||
## Browsers support | ||
Baron uses two old `CSS 2.1` technologies: 1) `overflow: scroll` 2) `overflow: hidden`. | ||
| <img src="http://diokuz.github.io/pics/chrome.png" width="48px" height="48px" alt="Chrome logo"> | <img src="http://diokuz.github.io/pics/firefox.png" width="48px" height="48px" alt="Firefox logo"> | <img src="http://diokuz.github.io/pics/ie.png" width="48px" height="48px" alt="Internet Explorer logo"> | <img src="http://diokuz.github.io/pics/opera.png" width="48px" height="48px" alt="Opera logo"> | <img src="http://diokuz.github.io/pics/safari.png" width="48px" height="48px" alt="Safari logo"> | <img src="http://diokuz.github.io/pics/android.png" width="48px" height="48px" alt="Android browser logo"> | | ||
|:---:|:---:|:---:|:---:|:---:|:---:| | ||
| 1+ ✔ | 1+ ✔ | 6+ ✔ | 9+ ✔ | 5+ ✔ | 4+ ✔ | | ||
`overflow: scroll` not supported by Opera mini and old versions of Android browser (2-). That means, you cannot make scrollable html-elements for them anyway. | ||
! Also, **Firefox for Mac OS X**, in default non-persistant scrollbar mode [is not supported](https://github.com/Diokuz/baron/issues/110). | ||
## 1.0 migration | ||
If you have any problems, just set [`cssGuru`](#params) option to `true`. | ||
If you have any problems, just set [`cssGuru`](docs/api.md) option to `true`. | ||
@@ -74,4 +86,4 @@ ## Simple usage | ||
.scroller { | ||
-ms-overflow-style: none; // better feel in ie10+ in some rare cases | ||
overflow-y: scroll; | ||
-ms-overflow-style: none; /* better feel in ie10+ in some rare cases */ | ||
/* -webkit-overflow-scrolling: touch; *//* uncomment to accelerate scrolling on iOS */ | ||
@@ -91,3 +103,3 @@ } | ||
} | ||
.baron .scroller__track { | ||
.baron > .scroller__track { | ||
display: block; /* Visible when scrolling is possible */ | ||
@@ -113,212 +125,10 @@ } | ||
and store baron scrollbar object to `scroll` variable (or dont - baron stores all its instances and links them with html-nodes). | ||
## [Chaining](docs/chaining.md) | ||
where: | ||
## [Horizontal and bidirectional scroll](docs/bidir.md) | ||
<a name="params"></a> | ||
```js | ||
var params = { | ||
// Flag, indicating that you know your css, | ||
// and baron must minimize the count of setted inline css rules | ||
// (i.e. overflow: hidden for clipper and overflow-y: scroll for scroller) | ||
// Default: false | ||
cssGuru: true, | ||
## [Plugins](docs/plugins.md) | ||
// Whos width (height) will be setted? | ||
// Default: 'scroller' for vertical, 'clipper' for horizontal direction. | ||
impact: 'scroller', | ||
// Selector for `scroller` element. | ||
// Default: this (in jQuery mode). | ||
scroller: '.scroller', | ||
// `Root` html element for baron. Use this param when your html-scrollbar content is outside scroller | ||
// Default: scroller | ||
root: $('.my_scroller'), | ||
// Selector for `bar` element | ||
// Default: 'undefined' | ||
bar: '.scroller__bar', | ||
// `Track` | ||
// Default: parent node of bar | ||
track: '.scroller__track', | ||
// CSS classname for `scroller` when its needed (when content height above scroller heights) | ||
// Default: 'baron' | ||
barOnCls: 'baron', | ||
// Note: by default scroller__bar should be invisible | ||
// CSS classname for `scroller` from start till end + 300ms of scrolling process | ||
// You can boost performance by using `_scrolling {pointer-events: none}` | ||
// Default: undefined | ||
scrollingCls: '_scrolling', | ||
// CSS classname for `bar` when it dragging by cursor | ||
// Its better than `.bar:hover` rule | ||
// Default: undefined | ||
draggingCls: '_dragging', | ||
// Scroll direction | ||
// Default: 'v' (vertical), 'h' for second baron invocation | ||
direction: 'h', | ||
// Minimum time delay between two resize events fires in seconds [0..1] or milliseconds (1..∞) | ||
// Default: 300 ms | ||
resizeDebounce: .2, // s | ||
// Local copy of jQuery-like utility | ||
// Default: window.jQuery | ||
$: function(selector, context) { | ||
return bonzo(qwery(selector, context)); | ||
}, | ||
// Event manager | ||
// Default: function(elem, event, func, mode) { params.$(elem)[mode || 'on'](event, func); }; | ||
event: function(elem, event, func, mode) { // Events manager | ||
if (mode == 'trigger') { | ||
mode = 'fire'; | ||
} | ||
bean[mode || 'on'](elem, event, func); | ||
} | ||
}; | ||
``` | ||
All parameters are optional (except scroller; or root, if you are not using baron as jQuery plugin). | ||
## Methods | ||
### update | ||
In some cases, such as infinity scroll (container size changing) in old browsers, which does not support MutationObserver; or css-transition applied to size, need for baron updating is raises. You can do this in two ways: | ||
```js | ||
// 1. Invoke update method on baron-variable, which you stored after baron initialization | ||
scroll.update(); | ||
// 2. Invoke update method on html-node | ||
$('.scroller').baron().update(); | ||
// In that case you use baron() just as getter for baron instance from $('.scroller') html-nodes, and to do this, you should call baron() without arguments; or it will throw a "second inicialization" error. | ||
``` | ||
### dispose | ||
If html-block with scroller is removed from your page, to prevent memory-leaking and performance issues, you should dispose corresponding baron instances, by calling method dispose: | ||
```js | ||
scroll.dispose(); | ||
// or | ||
$('.scroller').baron().dispose(); | ||
``` | ||
Note: baron returns the baron object, even in jQuery mode. That breaks jQuery chaining. For example, you can't do this: | ||
```js | ||
$('.scroller').baron().css().animate(); | ||
``` | ||
but you can: | ||
```js | ||
$('.scroller').css().animate() // jQuery chaining | ||
.baron().update(); // baron chaining | ||
``` | ||
and even more: | ||
```js | ||
var scroll = $('.scroller').css().animate().baron().fix(); | ||
scroll.baron({direction: 'h'}).test().anotherBaronPlugin(); | ||
``` | ||
Every baron plugin sould return baron object (this); | ||
## Horizontal and bidirectional scroll | ||
To switch default vertical direction to horizontal direction just set 'direction' param to 'h' value: | ||
```js | ||
baron({ | ||
... | ||
direction: 'h' | ||
}); | ||
``` | ||
If you want to scroll in both directions (vertical and horizontal) you must initialize baron two times: one per direction. In than case you can do chaining: | ||
```js | ||
baron(vParams).baron(hParams); | ||
``` | ||
Note: think about horizontal baron as about second independent baron instance, or as about plugin for 'baron', which simply calls 'baron' with redefined default params - both statements are true, actually. Unfortunately, in case above you only can manage last baron instance in chain (to update or dispose it). To manage both you have to initialize them independently: | ||
```js | ||
vScroll = baron(vParams); | ||
hScroll = baron(hParams); | ||
... | ||
vScroll.dispose(); | ||
hScroll.dispose(); | ||
``` | ||
*Note: horizontal scroll works in a different way: height of scroller is auto (you can set it to particular value in CSS), and height of clipper is varing by baron.* | ||
## Updating baron | ||
When container size changed (for example: you load additional data to the container using ajax), you should call update() method: | ||
```js | ||
scroll.update(); | ||
``` | ||
or fire custom event 'sizeChange' to wrapper: | ||
```js | ||
$('.scroller').trigger('sizeChange'); | ||
``` | ||
## Disposing baron | ||
If you removed html-nodes, which was used by baron, from DOM, dont forget dispose related baron instance manually. Use 'dispose' method for that. There are two ways for disposing: | ||
```js | ||
var scroll = $('.scroller').baron(); | ||
scroll.dispose(); | ||
// or | ||
$('.scroller').baron().dispose(); | ||
``` | ||
Baron stores all its instances in window.baron._instances, and link them with html-nodes by data-baron-[dir]-id attribute values. | ||
##noConflict mode | ||
If you need window.baron for another purposes you can restore original value: | ||
```js | ||
// window.baron points to some other library | ||
... | ||
// you include baron, it replaces the window.baron variable to baron namespace | ||
var graf = baron.noConflict(); | ||
// now window.baron points to that other library again, and you can use window.graf() etc. | ||
``` | ||
## Browsers support | ||
Baron uses two old `CSS 2.1` technologies: 1) `overflow: scroll` 2) `overflow: hidden`. | ||
| <img src="http://diokuz.github.io/pics/chrome.png" width="48px" height="48px" alt="Chrome logo"> | <img src="http://diokuz.github.io/pics/firefox.png" width="48px" height="48px" alt="Firefox logo"> | <img src="http://diokuz.github.io/pics/ie.png" width="48px" height="48px" alt="Internet Explorer logo"> | <img src="http://diokuz.github.io/pics/opera.png" width="48px" height="48px" alt="Opera logo"> | <img src="http://diokuz.github.io/pics/safari.png" width="48px" height="48px" alt="Safari logo"> | <img src="http://diokuz.github.io/pics/android.png" width="48px" height="48px" alt="Android browser logo"> | | ||
|:---:|:---:|:---:|:---:|:---:|:---:| | ||
| 1+ ✔ | 1+ ✔ | 6+ ✔ | 9+ ✔ | 5+ ✔ | 4+ ✔ | | ||
`overflow: scroll` not supported by Opera mini and old versions of Android browser (2-). That means, you cannot make scrollable html-elements for them anyway. | ||
## Plugins | ||
@see [docs/plugins.md](https://github.com/Diokuz/baron/blob/master/docs/plugins.md) | ||
## License | ||
MIT. |
@@ -17,3 +17,3 @@ (function(window, undefined) { | ||
client: 'clientHeight', crossClient: 'clientWidth', | ||
crossScroll: 'scrollLeft', | ||
scrollEdge: 'scrollLeft', | ||
offset: 'offsetHeight', crossOffset: 'offsetWidth', offsetPos: 'offsetTop', | ||
@@ -27,3 +27,3 @@ scroll: 'scrollTop', scrollSize: 'scrollHeight' | ||
client: 'clientWidth', crossClient: 'clientHeight', | ||
crossScroll: 'scrollTop', | ||
scrollEdge: 'scrollTop', | ||
offset: 'offsetWidth', crossOffset: 'offsetHeight', offsetPos: 'offsetLeft', | ||
@@ -331,2 +331,7 @@ scroll: 'scrollLeft', scrollSize: 'scrollWidth' | ||
out.scrollEdge = 0; | ||
if (params.rtl) { | ||
out.scrollEdge = out.clipper[out.origin.scrollEdge]; // initial position | ||
} | ||
return out; | ||
@@ -683,7 +688,6 @@ } | ||
this.clipperOnScroll = function() { | ||
var scrollEdge = this.origin.crossScroll; | ||
if (this.direction == 'h') return; | ||
if (this.clipper[scrollEdge]) { | ||
this.clipper[scrollEdge] = 0; | ||
} | ||
// clipper.scrollLeft = initial scroll position (0 for ltr, 17 for rtl) | ||
this.clipper[this.origin.scrollEdge] = this.scrollEdge; | ||
}; | ||
@@ -783,3 +787,3 @@ | ||
baron.version = '1.0.0'; | ||
baron.version = '1.1.0'; | ||
@@ -786,0 +790,0 @@ if ($ && $.fn) { // Adding baron to jQuery as plugin |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2316
118385
130