From aafd39cc0d2c626eb26fe4b61bba9563f3d2ae71 Mon Sep 17 00:00:00 2001 From: weizhansheng Date: Tue, 1 Nov 2016 14:42:23 +0800 Subject: [PATCH] fix snap bug --- src/snap/snap.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/snap/snap.js b/src/snap/snap.js index ebed8a37..bc883202 100644 --- a/src/snap/snap.js +++ b/src/snap/snap.js @@ -2,8 +2,10 @@ _initSnap: function () { this.currentPage = {}; - if ( typeof this.options.snap == 'string' ) { - this.options.snap = this.scroller.querySelectorAll(this.options.snap); + this.options.snapSelector = this.options.snapSelector || this.options.snap; + + if ( typeof this.options.snapSelector == 'string' ) { + this.options.snap = this.scroller.querySelectorAll(this.options.snapSelector); } this.on('refresh', function () { @@ -18,6 +20,10 @@ this.pages = []; + if ( typeof this.options.snapSelector == 'string' ) { + this.options.snap = this.scroller.querySelectorAll(this.options.snapSelector); + } + if ( !this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight ) { return; }