Skip to content

Commit

Permalink
2.4.2 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Jan 19, 2014
1 parent bcced26 commit 87bc11c
Show file tree
Hide file tree
Showing 8 changed files with 2,891 additions and 15 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
<h2>About</h2>
<p><strong>Swiper</strong> - is the <strong>free and ultra lightweight</strong> mobile touch slider with hardware accelerated transitions (where supported) and amazing native behavior. It is intended to use in mobile websites, mobile web apps, and mobile native apps. Designed mostly for iOS, but also works on Android and latest Desktop browsers. <strong>Swiper</strong> is created by <a href="http://www.idangero.us">iDangero.us</a></p>
<h2>Change Log</h2>
<h3>Swiper 2.4.2 - Updated on January 19, 2014</h3>
<ul>
<li>New <a href="http://www.idangero.us/sliders/swiper/api.php">api</a> parameters: autoplayStopOnLast, longSwipesRatio, eventTarger, preventLinksPropagation</li>
<li>Now "looped" slides have additional "swiper-slide-duplicate" class</li>
<li>Updated onProgressChange callback to work with new Callbacks API</li>
<li>Minor fixes</li>
</ul>
<h3>Swiper 2.4.1 - Updated on December 15, 2013</h3>
<ul>
<li>Mousewheel fixes, new <b>mousewheelForceToAxis</b> parameter</li>
<li>Improved old IE animation timings</li>
<li>Updated Swiper's CSS with content-box property on .swiper-wrapper</li>
</ul>
<h3>Swiper 2.4.0 - Updated on December 6, 2013</h3>
<ul>
<li>New callbacks onSlideNext, onSlidePrev</li>
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "swiper",
"repo": "nolimits4web/Swiper",
"description": "Mobile touch slider and framework with hardware accelerated transitions",
"version": "2.4.1",
"version": "2.4.2",
"keywords": ["swiper", "swipe", "slider"],
"dependencies": {
},
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "swiper",
"repo": "nolimits4web/Swiper",
"description": "Mobile touch slider and framework with hardware accelerated transitions",
"version": "2.4.1",
"version": "2.4.2",
"keywords": ["swiper", "swipe", "slider"],
"dependencies": {
},
Expand Down
51 changes: 43 additions & 8 deletions dev/idangerous.swiper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Swiper 2.4+ - Mobile Touch Slider
* Swiper 2.4.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: December 22, 2013
* Updated on: January 19, 2014
*/
var Swiper = function (selector, params) {
/*=========================
Expand Down Expand Up @@ -134,6 +134,7 @@ var Swiper = function (selector, params) {
simulateTouch : true,
followFinger : true,
shortSwipes : true,
longSwipesRatio: 0.5,
moveStartThreshold:false,
onlyExternal : false,
createPagination : true,
Expand All @@ -144,6 +145,7 @@ var Swiper = function (selector, params) {
resistance : true, // or false or 100%
scrollContainer : false,
preventLinks : true,
preventLinksPropagation: false,
noSwiping : false, // or class
noSwipingClass : 'swiper-no-swiping', //:)
initialSlide: 0,
Expand All @@ -154,6 +156,7 @@ var Swiper = function (selector, params) {
// Autoplay
autoplay: false,
autoplayDisableOnInteraction: true,
autoplayStopOnLast: false,
//Loop mode
loop:false,
loopAdditionalSlides:0,
Expand Down Expand Up @@ -488,6 +491,8 @@ var Swiper = function (selector, params) {
callback[i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5])
}
}
} else if (Object.prototype.toString.call( callback ) === '[object String]') {
if (params['on'+callback]) _this.fireCallback(params['on'+callback]);
} else {
callback(arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
}
Expand Down Expand Up @@ -809,6 +814,23 @@ var Swiper = function (selector, params) {
// swipe to active slide in fixed mode
if (!params.freeMode) {
_this.swipeTo((params.loop ? _this.activeLoopIndex : _this.activeIndex), 0, false);
// Fix autoplay
if (params.autoplay) {
if (_this.support.transitions && typeof autoplayTimeoutId !== 'undefined') {
if (typeof autoplayTimeoutId !== 'undefined') {
clearTimeout(autoplayTimeoutId);
autoplayTimeoutId = undefined;
_this.startAutoplay();
}
}
else {
if (typeof autoplayIntervalId !== 'undefined') {
clearInterval(autoplayIntervalId)
autoplayIntervalId = undefined;
_this.startAutoplay();
}
}
}
}

// move wrapper to the beginning in free mode
Expand Down Expand Up @@ -1206,6 +1228,9 @@ var Swiper = function (selector, params) {
if (!_this.allowLinks) {
if(e.preventDefault) e.preventDefault();
else e.returnValue = false;
if (params.preventLinksPropagation && 'stopPropagation' in e) {
e.stopPropagation();
}
return false;
}
}
Expand Down Expand Up @@ -1597,15 +1622,15 @@ var Swiper = function (selector, params) {
targetSlideSize = slideSize * params.slidesPerView;
}
if (direction=="toNext" && ( timeDiff > 300 ) ) {
if (diffAbs >= targetSlideSize*0.5) {
if (diffAbs >= targetSlideSize*params.longSwipesRatio) {
_this.swipeNext(true)
}
else {
_this.swipeReset()
}
}
if (direction=="toPrev" && ( timeDiff > 300 ) ) {
if (diffAbs >= targetSlideSize*0.5) {
if (diffAbs >= targetSlideSize*params.longSwipesRatio) {
_this.swipePrev(true);
}
else {
Expand Down Expand Up @@ -2101,7 +2126,13 @@ var Swiper = function (selector, params) {
_this.callPlugins('onAutoplayStart');
autoplayIntervalId = setInterval(function(){
if (params.loop) _this.swipeNext(true);
else if (!_this.swipeNext(true)) _this.swipeTo(0);
else if (!_this.swipeNext(true)) {
if (!params.autoplayStopOnLast) _this.swipeTo(0);
else {
clearInterval(autoplayIntervalId);
autoplayIntervalId = undefined;
}
}
}, params.autoplay)
}
}
Expand All @@ -2122,16 +2153,20 @@ var Swiper = function (selector, params) {
autoplayIntervalId = undefined;
_this.callPlugins('onAutoplayStop');
}


}
function autoplay(){
autoplayTimeoutId = setTimeout(function(){
if(params.loop) {
_this.fixLoop();
_this.swipeNext(true);
}
else if (!_this.swipeNext(true)) _this.swipeTo(0);
else if (!_this.swipeNext(true)) {
if (!params.autoplayStopOnLast) _this.swipeTo(0);
else {
clearTimeout(autoplayTimeoutId);
autoplayTimeoutId = undefined;
}
}
_this.wrapperTransitionEnd(function(){
if (typeof autoplayTimeoutId !== 'undefined') autoplay();
})
Expand Down
Loading

0 comments on commit 87bc11c

Please sign in to comment.