Showing
2 changed files
with
17 additions
and
9 deletions
@@ -112,6 +112,10 @@ function subClassifyTapEvt($this) { | @@ -112,6 +112,10 @@ function subClassifyTapEvt($this) { | ||
112 | }); | 112 | }); |
113 | } | 113 | } |
114 | 114 | ||
115 | + if (hCbFn) { | ||
116 | + hCbFn(); | ||
117 | + } | ||
118 | + | ||
115 | hideFilter(); | 119 | hideFilter(); |
116 | } | 120 | } |
117 | 121 | ||
@@ -164,14 +168,13 @@ function initFilter(opt) { | @@ -164,14 +168,13 @@ function initFilter(opt) { | ||
164 | }); | 168 | }); |
165 | if (opt.isScroll) { | 169 | if (opt.isScroll) { |
166 | $('ul.sub-classify').each(function() { | 170 | $('ul.sub-classify').each(function() { |
171 | + var lastY = 0, y = 0; | ||
172 | + var $slider = $(this); | ||
167 | 173 | ||
168 | $(this).wrap('<div class=\'sub-classify-farther\' data-type=\'' + $(this).data('type') + '\'></div>'); | 174 | $(this).wrap('<div class=\'sub-classify-farther\' data-type=\'' + $(this).data('type') + '\'></div>'); |
169 | 175 | ||
170 | // $(this).removeClass("sub-classify"); | 176 | // $(this).removeClass("sub-classify"); |
171 | 177 | ||
172 | - var lastY = 0, y = 0; | ||
173 | - var $slider = $(this); | ||
174 | - | ||
175 | $slider.on('touchstart', function(e) { | 178 | $slider.on('touchstart', function(e) { |
176 | lastY = e.originalEvent.touches[0].pageY; | 179 | lastY = e.originalEvent.touches[0].pageY; |
177 | }); | 180 | }); |
@@ -180,21 +183,26 @@ function initFilter(opt) { | @@ -180,21 +183,26 @@ function initFilter(opt) { | ||
180 | var deltaY = curY - lastY; | 183 | var deltaY = curY - lastY; |
181 | var height = $(this)[0].scrollHeight; | 184 | var height = $(this)[0].scrollHeight; |
182 | var limit = height - $(this).parent().height(); | 185 | var limit = height - $(this).parent().height(); |
186 | + var translate; | ||
187 | + | ||
183 | y = y + deltaY; | 188 | y = y + deltaY; |
184 | - if (y < limit * -1) | 189 | + if (y < limit * -1) { |
185 | y = limit * -1; | 190 | y = limit * -1; |
186 | - if (y > 0) | 191 | + } |
192 | + | ||
193 | + if (y > 0) { | ||
187 | y = 0; | 194 | y = 0; |
188 | - var translate = 'translate3d(0,' + y + 'px,0)'; | 195 | + } |
196 | + translate = 'translate3d(0,' + y + 'px,0)'; | ||
189 | $(this).css({ | 197 | $(this).css({ |
190 | '-moz-transform': translate, | 198 | '-moz-transform': translate, |
191 | '-ms-transform': translate, | 199 | '-ms-transform': translate, |
192 | 'transform': translate, | 200 | 'transform': translate, |
193 | - '-webkit-transform': translate, | 201 | + '-webkit-transform': translate |
194 | }); | 202 | }); |
195 | lastY = curY; | 203 | lastY = curY; |
196 | }); | 204 | }); |
197 | - $slider.on('touchend', function(e) {}); | 205 | + $slider.on('touchend', function() {}); |
198 | }); | 206 | }); |
199 | } | 207 | } |
200 | 208 |
-
Please register or login to post a comment