Skip to content

Commit

Permalink
2.2 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Sep 15, 2013
1 parent c0856aa commit 0b12831
Show file tree
Hide file tree
Showing 5 changed files with 2,806 additions and 8 deletions.
38 changes: 32 additions & 6 deletions dev/idangerous.swiper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Swiper 2.0 - Mobile Touch Slider
* Swiper 2.2+ - Mobile Touch Slider
* http://www.idangero.us/sliders/swiper/
*
* Copyright 2012-2013, Vladimir Kharlampidi
Expand All @@ -8,7 +8,7 @@
*
* Licensed under GPL & MIT
*
* Updated on: June 9, 2013
* Updated on: September 15, 2013
*/
var Swiper = function (selector, params) {
/*=========================
Expand Down Expand Up @@ -1151,7 +1151,7 @@ var Swiper = function (selector, params) {
_this.positions.start = _this.positions.current = _this.getWrapperTranslate();

//Set Transform
//_this.setWrapperTranslate(_this.positions.start);
_this.setWrapperTranslate(_this.positions.start);

//TouchStartTime
_this.times.start = (new Date()).getTime();
Expand Down Expand Up @@ -1377,12 +1377,19 @@ var Swiper = function (selector, params) {
var maxPosition = maxWrapperPosition();

//Not moved or Prevent Negative Back Sliding/After-End Sliding
if (!_this.isMoved && params.freeMode) {
_this.isMoved = false;
if (params.onTouchEnd) params.onTouchEnd(_this);
_this.callPlugins('onTouchEnd');
return;
}
if (!_this.isMoved || _this.positions.current > 0 || _this.positions.current < -maxPosition) {
_this.swipeReset();
if (params.onTouchEnd) params.onTouchEnd(_this);
_this.callPlugins('onTouchEnd');
return;
}

_this.isMoved = false;

//Free Mode
Expand Down Expand Up @@ -2016,7 +2023,6 @@ var Swiper = function (selector, params) {

_this.fixLoop = function() {
var newIndex;

//Fix For Negative Oversliding
if (_this.activeIndex < _this.loopedSlides) {
newIndex = _this.slides.length - _this.loopedSlides*3 + _this.activeIndex;
Expand Down Expand Up @@ -2249,7 +2255,6 @@ Swiper.prototype = {

setWrapperTransition : function (duration) {
var es = this.wrapper.style;

es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = (duration / 1000) + 's';
this.callPlugins('onSetWrapperTransition', {duration: duration});
},
Expand Down Expand Up @@ -2348,7 +2353,28 @@ Swiper.prototype = {
}
}
},

setTransform : function (el, transform) {
var es = el.style
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transform
},
setTranslate : function (el, translate) {
var es = el.style
var pos = {
x : translate.x || 0,
y : translate.y || 0,
z : translate.z || 0
};
var transformString = this.support.transforms3d ? 'translate3d('+(pos.x)+'px,'+(pos.y)+'px,'+(pos.z)+'px)' : 'translate('+(pos.x)+'px,'+(pos.y)+'px)';
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transformString;
if (!this.support.transforms) {
es.left = pos.x+'px'
es.top = pos.y+'px'
}
},
setTransition : function (el, duration) {
var es = el.style
es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = duration+'ms';
},
/*==================================================
Feature Detection
====================================================*/
Expand Down
Loading

0 comments on commit 0b12831

Please sign in to comment.