Skip to content

Commit

Permalink
1.9.4 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed May 23, 2013
1 parent 9d3cda8 commit b72243f
Show file tree
Hide file tree
Showing 4 changed files with 1,615 additions and 35 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<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 1.9.4 - Updated on May 23, 2013</h3>
<ul>
<li>Fixed Autoplay in non loop mode with slidesPerSlide more than 1</li>
<li>Ability to enable/disable callback queues to get more control over the callbacks</li>
<li>Minor Fixes</li>
</ul>
<h3>Swiper 1.9.3 - Updated on April 30, 2013</h3>
<ul>
<li>Few important fixes including IE8 improvements</li>
Expand Down
78 changes: 43 additions & 35 deletions dev/idangerous.swiper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Swiper 1.9.2+ - Mobile Touch Slider
* Swiper 1.9.4 - 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: April 19, 2013
* Updated on: May 23, 2013
*/
var Swiper = function (selector, params, callback) {
/*=========================
Expand Down Expand Up @@ -110,10 +110,11 @@ var Swiper = function (selector, params, callback) {
mousewheelControl : false,
resizeEvent : 'auto', //or 'resize' or 'orientationchange'
useCSS3Transforms : true,
queueStartCallbacks : false,
queueEndCallbacks : false,
//Namespace
slideElement : 'div',
slideClass : 'swiper-slide',
slideActiveClass : 'swiper-slide-active',
wrapperClass : 'swiper-wrapper',
paginationClass: 'swiper-pagination-switch' ,
paginationActiveClass : 'swiper-active-switch'
Expand Down Expand Up @@ -603,7 +604,8 @@ var Swiper = function (selector, params, callback) {
autoPlay = setInterval(function(){
var newSlide = _this.realIndex + 1
if ( newSlide == numOfSlides) newSlide = 0
_this.swipeTo(newSlide)
if ( newSlide == numOfSlides - params.slidesPerSlide + 1) newSlide=0;
_this.swipeTo(newSlide)
}, params.autoPlay)
}
else if (params.autoPlay && params.loop) {
Expand Down Expand Up @@ -691,7 +693,7 @@ var Swiper = function (selector, params, callback) {
}
}
function preventClick(e) {
if (!_this.allowLinks) e.preventDefault();
if (!_this.allowLinks) (e.preventDefault) ? e.preventDefault() : e.returnValue = false;
}

/*==========================================
Expand Down Expand Up @@ -732,7 +734,6 @@ var Swiper = function (selector, params, callback) {
_this._wheelEvent = "DOMMouseScroll";
}
function handleMousewheel (e) {
if(e.preventDefault) e.preventDefault();
var we = _this._wheelEvent;
var delta;
//Opera & IE
Expand Down Expand Up @@ -769,8 +770,8 @@ var Swiper = function (selector, params, callback) {
_this.setTransform(x,y,0)
}

if(event.preventDefault) event.preventDefault();
else event.returnValue = false;
if(e.preventDefault) e.preventDefault();
else e.returnValue = false;
return false;
}
if (_this._wheelEvent) {
Expand Down Expand Up @@ -1298,25 +1299,44 @@ var Swiper = function (selector, params, callback) {
function slideChangeCallbacks() {
//Transition Start Callback
_this.callPlugins('onSlideChangeStart');
if (params.onSlideChangeStart && !_this._queueStartCallbacks) {
_this._queueStartCallbacks = true;
params.onSlideChangeStart(_this)
_this.transitionEnd(function(){
_this._queueStartCallbacks = false;
})
}
if (params.onSlideChangeStart) {
if (params.queueStartCallbacks && !_this._queueStartCallbacks) {
_this._queueStartCallbacks = true;
params.onSlideChangeStart(_this)
_this.transitionEnd(function(){
_this._queueStartCallbacks = false;
})
}
else if (!params.queueStartCallbacks) {
params.onSlideChangeStart(_this)
}
}

//Transition End Callback
if (params.onSlideChangeEnd && !_this._queueEndCallbacks) {
if(_this.support.transitions) {
_this._queueEndCallbacks = true;
_this.transitionEnd(params.onSlideChangeEnd)
if (params.onSlideChangeEnd) {
if (params.queueEndCallbacks && !_this.queueEndCallbacks) {
if(_this.support.transitions) {
_this._queueEndCallbacks = true;
_this.transitionEnd(params.onSlideChangeEnd)
}
else {
setTimeout(function(){
params.onSlideChangeEnd(_this)
},10)
}
}
else {
setTimeout(function(){
params.onSlideChangeEnd(_this)
},10)
else if (!params.queueEndCallbacks) {
if(_this.support.transitions) {
_this.transitionEnd(params.onSlideChangeEnd)
}
else {
setTimeout(function(){
params.onSlideChangeEnd(_this)
},10)
}

}

}
}

Expand All @@ -1337,25 +1357,13 @@ var Swiper = function (selector, params, callback) {
if (_this.realIndex<0) _this.realIndex = 0
//Legacy
_this.activeSlide = _this.activeIndex;

// mark active slide
var activeClassRegexp = new RegExp( "\\s*" + params.slideActiveClass );
for ( var i = 0; i < numOfSlides; ++i )
{
_this.slides[ i ].className = _this.slides[ i ].className.replace( activeClassRegexp, '' );
}

_this.slides[ _this.activeIndex ].className += ' ' + params.slideActiveClass;

//Update Pagination
if (params.pagination) {
_this.updatePagination()
}

}



/*=========================
Loop Fixes
===========================*/
Expand Down
Loading

0 comments on commit b72243f

Please sign in to comment.