Skip to content

Commit db2ad15

Browse files
committed
update to fixed issuse
1 parent 487ca5a commit db2ad15

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

slider/slider.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
auto:true
2828
};
2929

30-
var extend = function(target,source){
30+
var assign = function(target,source){
3131
var res = {};
3232
if(Object.assign){
3333
return Object.assign(res,target,source);
@@ -46,7 +46,7 @@
4646
}
4747

4848
function Slider( selector, options ) {
49-
var config = extend(defaultOption,options);
49+
var config = assign(defaultOption,options);
5050
return new Slider.init( selector, config );
5151
}
5252

@@ -88,10 +88,10 @@
8888
this.auto && this.autoRun();
8989
this.wrap.addEventListener('touchstart',this,false);
9090
this.wrap.addEventListener('touchmove',this,false);
91-
document.body.addEventListener('touchend',this,false);
91+
this.wrap.addEventListener('touchend',this,false);
9292
this.wrap.addEventListener('mousedown',this,false);
9393
this.wrap.addEventListener('mousemove',this,false);
94-
document.body.addEventListener('mouseup',this,false);
94+
this.wrap.addEventListener('mouseup',this,false);
9595
},
9696
handleEvent:function(e){
9797
var type = e.type;
@@ -102,15 +102,15 @@
102102
switch(type){
103103
case 'mousedown':
104104
case 'touchstart':
105-
this.axis.x = e.clientX;
105+
this.axis.x = e.pageX;
106106
this.axis.y = e.clientY;
107107
this.enableSlide = true;
108108
this.auto = false;
109109
clearTimeout(this.timmerId);
110110
break;
111111
case 'mouseup':
112112
case 'touchend':
113-
var distance = e.clientX - this.axis.x;
113+
var distance = e.pageX - this.axis.x;
114114
var bounce = Math.round(this.width * this.bounce);
115115
this.enableSlide = false;
116116
if(Math.abs(distance)>bounce){
@@ -172,24 +172,28 @@
172172
return {
173173
WebkitTransform:"translate3d(" + distance + ",0px,0px)",
174174
transform:"translate3d(" + distance + ",0px,0px)",
175-
WebkitTransition : 'translate '+ this.speed+' ease',
176-
transition:'translate '+ this.speed+' ease'
175+
WebkitTransition : 'none',
176+
transition:'none'
177177
}
178178
},
179179
animate:function(distance){
180180
return {
181181
WebkitTransform:"translate3d(" + distance + ",0px,0px)",
182182
transform:"translate3d(" + distance + ",0px,0px)",
183183
WebkitTransition : 'all '+ this.speed+' ease',
184-
transition:'all '+ this.speed+' ease'
184+
transition:'all '+ this.speed+' ease',
185+
visibility: 'visible',
186+
zIndex:9
185187
}
186188
},
187189
noAnimate:function(distance){
188190
return {
189191
WebkitTransform:"translate3d(" + distance + ",0px,0px)",
190192
transform:"translate3d(" + distance + ",0px,0px)",
191193
WebkitTransition : 'none',
192-
transition:'none'
194+
transition:'none',
195+
visibility: 'hidden',
196+
zIndex:0
193197
}
194198
},
195199
next:function(){

0 commit comments

Comments
 (0)