X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=ux%2FIscroll.js;h=12b257d9bd1caa95393e1624e0e1c346cc73ae6a;hb=5f0c20d0c4e6eb4fb63ad64ac5dd3323de1b6c0c;hp=69ab02d63e59d850e361edf01955edfe985c1bd0;hpb=f89440f37a64ccf9aea31fb32f57f55745017b89;p=roojs1 diff --git a/ux/Iscroll.js b/ux/Iscroll.js index 69ab02d63e..12b257d9bd 100644 --- a/ux/Iscroll.js +++ b/ux/Iscroll.js @@ -3,60 +3,66 @@ * Released under MIT license, http://cubiq.org/license */ -namespace('Roo.ux'); +// should we even bother...??? +Roo.namespace('Roo.ux'); (function(){ -var m = Math, - vendor = (/webkit/i).test(navigator.appVersion) ? 'webkit' : - (/firefox/i).test(navigator.userAgent) ? 'Moz' : - 'opera' in window ? 'O' : '', - - // Browser capabilities - has3d = 'WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix(), - hasTouch = 'ontouchstart' in window, - hasTransform = vendor + 'Transform' in document.documentElement.style, - isAndroid = (/android/gi).test(navigator.appVersion), - isIDevice = (/iphone|ipad/gi).test(navigator.appVersion), - isPlaybook = (/playbook/gi).test(navigator.appVersion), - hasTransitionEnd = isIDevice || isPlaybook, - nextFrame = (function() { - return window.requestAnimationFrame - || window.webkitRequestAnimationFrame - || window.mozRequestAnimationFrame - || window.oRequestAnimationFrame - || window.msRequestAnimationFrame - || function(callback) { return setTimeout(callback, 1); } - })(), - cancelFrame = (function () { - return window.cancelRequestAnimationFrame - || window.webkitCancelRequestAnimationFrame - || window.mozCancelRequestAnimationFrame - || window.oCancelRequestAnimationFrame - || window.msCancelRequestAnimationFrame - || clearTimeout - })(), - - // Events - RESIZE_EV = 'onorientationchange' in window ? 'orientationchange' : 'resize', - START_EV = hasTouch ? 'touchstart' : 'mousedown', - MOVE_EV = hasTouch ? 'touchmove' : 'mousemove', - END_EV = hasTouch ? 'touchend' : 'mouseup', - CANCEL_EV = hasTouch ? 'touchcancel' : 'mouseup', - WHEEL_EV = vendor == 'Moz' ? 'DOMMouseScroll' : 'mousewheel', - - // Helpers - trnOpen = 'translate' + (has3d ? '3d(' : '('), - trnClose = has3d ? ',0)' : ')'; + var m = Math, + vendor = (/webkit/i).test(navigator.appVersion) ? 'webkit' : + (/firefox/i).test(navigator.userAgent) ? 'Moz' : + 'opera' in window ? 'O' : '', + + // Browser capabilities + has3d = 'WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix(), + hasTouch = 'ontouchstart' in window, + hasTransform = vendor + 'Transform' in document.documentElement.style, + isAndroid = (/android/gi).test(navigator.appVersion), + isIDevice = (/iphone|ipad/gi).test(navigator.appVersion), + isPlaybook = (/playbook/gi).test(navigator.appVersion), + hasTransitionEnd = isIDevice || isPlaybook, + nextFrame = (function() { + return window.requestAnimationFrame + || window.webkitRequestAnimationFrame + || window.mozRequestAnimationFrame + || window.oRequestAnimationFrame + || window.msRequestAnimationFrame + || function(callback) { return setTimeout(callback, 1); } + })(), + cancelFrame = (function () { + return window.cancelRequestAnimationFrame + || window.webkitCancelRequestAnimationFrame + || window.mozCancelRequestAnimationFrame + || window.oCancelRequestAnimationFrame + || window.msCancelRequestAnimationFrame + || clearTimeout + })(), + + // Events + RESIZE_EV = 'onorientationchange' in window ? 'orientationchange' : 'resize', + START_EV = hasTouch ? 'touchstart' : 'mousedown', + MOVE_EV = hasTouch ? 'touchmove' : 'mousemove', + END_EV = hasTouch ? 'touchend' : 'mouseup', + CANCEL_EV = hasTouch ? 'touchcancel' : 'mouseup', + WHEEL_EV = vendor == 'Moz' ? 'DOMMouseScroll' : 'mousewheel', + + // Helpers + trnOpen = 'translate' + (has3d ? '3d(' : '('), + trnClose = has3d ? ',0)' : ')'; // Constructor - Roo.ux.iScroll = function (el, options) { +Roo.ux.iScroll = function (el, options) { var that = this, doc = document, i; - that.wrapper = typeof el == 'object' ? el : doc.getElementById(el); + + that.wrapper = typeof el == 'object' ? el : doc.getElementById(el); + that.wrapper.style.overflow = 'hidden'; that.scroller = that.wrapper.children[0]; + + + // Default options that.options = { @@ -141,7 +147,7 @@ var m = Math, }; // Prototype -iScroll.prototype = { +Roo.ux.iScroll.prototype = { enabled: true, x: 0, y: 0, @@ -199,7 +205,10 @@ iScroll.prototype = { if (that.options.scrollbarClass) bar.className = that.options.scrollbarClass + dir.toUpperCase(); else bar.style.cssText = 'position:absolute;z-index:100;' + (dir == 'h' ? 'height:7px;bottom:1px;left:2px;right:' + (that.vScrollbar ? '7' : '2') + 'px' : 'width:7px;bottom:' + (that.hScrollbar ? '7' : '2') + 'px;top:2px;right:1px'); - bar.style.cssText += ';pointer-events:none;-' + vendor + '-transition-property:opacity;-' + vendor + '-transition-duration:' + (that.options.fadeScrollbar ? '350ms' : '0') + ';overflow:hidden;opacity:' + (that.options.hideScrollbar ? '0' : '1'); + bar.style.cssText += ';pointer-events:none;-' + + vendor + '-transition-property:opacity;-' + + vendor + '-transition-duration:' + (that.options.fadeScrollbar ? '350ms' : '0') + + ';overflow:hidden;opacity:' + (that.options.hideScrollbar ? '0' : '1'); that.wrapper.appendChild(bar); that[dir + 'ScrollbarWrapper'] = bar; @@ -1043,7 +1052,7 @@ iScroll.prototype = { } }; -if (typeof exports !== 'undefined') exports.iScroll = iScroll; -else window.iScroll = iScroll; +//if (typeof exports !== 'undefined') exports.iScroll = iScroll; +//else window.iScroll = iScroll; })(); \ No newline at end of file