diff --git a/build/iscroll.js b/build/iscroll.js index 6ab9256c..1e6d9a1f 100644 --- a/build/iscroll.js +++ b/build/iscroll.js @@ -270,10 +270,9 @@ var utils = (function () { return me; })(); -function IScroll (el, options) { +function IScroll (el, options, scroller) { this.wrapper = typeof el == 'string' ? document.querySelector(el) : el; - this.scroller = this.wrapper.children[0]; - this.scrollerStyle = this.scroller.style; // cache style for better performance + this.options = { @@ -303,8 +302,13 @@ function IScroll (el, options) { HWCompositing: true, useTransition: true, useTransform: true, - bindToWrapper: typeof window.onmousedown === "undefined" + bindToWrapper: typeof window.onmousedown === "undefined", + + snapWait: false }; + + this.scroller = (typeof scroller == 'undefined') ? this.wrapper.children[0] : scroller; + this.scrollerStyle = this.scroller.style; // cache style for better performance for ( var i in options ) { this.options[i] = options[i]; @@ -1352,6 +1356,9 @@ IScroll.prototype = { }, goToPage: function (x, y, time, easing) { + if(this.options.snapWait && ((!this.options.useTransition && this.isAnimating) || (this.options.useTransition && this.isInTransition))) + return; + easing = easing || this.options.bounceEasing; if ( x >= this.pages.length ) { @@ -1362,8 +1369,10 @@ IScroll.prototype = { if ( y >= this.pages[x].length ) { y = this.pages[x].length - 1; + return; } else if ( y < 0 ) { y = 0; + return; } var posX = this.pages[x][y].x,