Skip to content

Commit f61cb77

Browse files
committed
#10 修复页面内的元素无法触发click事件的bug
1 parent 2d8b153 commit f61cb77

File tree

7 files changed

+26
-31
lines changed

7 files changed

+26
-31
lines changed

dist/swiper.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* swiper - swiper.js
3-
* @version v1.4.0
2+
* iswiper - swiper.js
3+
* @version v1.4.1
44
* @link https://github.com/weui/swiper.git
55
* @license MIT
66
*/

dist/swiper.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* swiper - swiper.js
3-
* @version v1.4.0
2+
* iswiper - swiper.js
3+
* @version v1.4.1
44
* @link https://github.com/weui/swiper.git
55
* @license MIT
66
*/
@@ -19,7 +19,7 @@
1919
* @constructor
2020
*/
2121
function Swiper(options) {
22-
this.version = '1.4.0';
22+
this.version = '1.4.1';
2323
this._default = {container: '.swiper', item: '.item', direction: 'vertical', activeClass: 'active', threshold: 50, duration: 300};
2424
this._options = extend(this._default, options);
2525
this._start = {};
@@ -124,7 +124,6 @@
124124

125125
me._show(me._current);
126126

127-
e.preventDefault();
128127
}, false);
129128

130129
this.$container.addEventListener('transitionEnd', function (e) {

dist/swiper.min.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* swiper - swiper.js
3-
* @version v1.4.0
2+
* iswiper - swiper.js
3+
* @version v1.4.1
44
* @link https://github.com/weui/swiper.git
55
* @license MIT
66
*/

dist/swiper.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "swiper",
3-
"version": "1.4.0",
2+
"name": "iswiper",
3+
"version": "1.4.1",
44
"description": "swiper.js",
55
"author": "wechat ui team",
66
"scripts": {

src/swiper.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@
118118

119119
me._show(me._current);
120120

121-
e.preventDefault();
122121
}, false);
123122

124123
this.$container.addEventListener('transitionEnd', function (e) {

test/test.js

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,6 @@ describe('swiper should have the following properties', function(){
6363
}
6464
});
6565

66-
describe('it should add classes to dom', function(){
67-
var $slider = swiper.$items[swiper._current];
68-
var $items = $slider.querySelectorAll('*[toggle-class]');
69-
Array.prototype.forEach.call($items, function($item, index){
70-
var clazz = $item.getAttribute('toggle-class').split(/\s+/);
71-
for(var i = 0, len = clazz.length; i < len; i++){
72-
(function(i){
73-
it('.' + clazz, function(done){
74-
setTimeout(function(){
75-
assert($item.className.indexOf(clazz[i]) !== -1);
76-
done();
77-
}, 1000);
78-
});
79-
})(i);
80-
}
81-
});
82-
});
8366

8467
describe('.next()', function (){
8568
it('should translateY the container to the slide height & should add classes to dom', function (){
@@ -96,6 +79,20 @@ describe('.next()', function (){
9679
});
9780
});
9881

82+
describe('.go()', function (){
83+
it('should translateY the container to the slide height & should add classes to dom', function (){
84+
swiper.go(0);
85+
for(var i = 1, len = swiper.$items.length; i < len; i++){
86+
swiper.go(i);
87+
var height = swiper.$items[i].style['height'].replace('px', '');
88+
var expect = 'translate3d(0px, -'+ (height * i) +'px, 0px)';
89+
90+
assert(swiper._current === i);
91+
assert(swiper.$container.style['-webkit-transform'] === expect);
92+
}
93+
});
94+
});
95+
9996
describe('.on()', function (){
10097
it('swiped listener should not be empty', function (){
10198

0 commit comments

Comments
 (0)