Skip to content

Commit

Permalink
1.9.2 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Apr 19, 2013
1 parent d1af008 commit 99218d1
Show file tree
Hide file tree
Showing 4 changed files with 1,572 additions and 16 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 1.9.2 - Updated on April 19, 2013</h3>
<ul>
<li>New <a href="http://www.idangero.us/sliders/swiper/api.php">API</a> features:
<ul>
<li>New feature to enable 100% resitance with <code>nopeek</code> parameter</li>
<li>New feature to disable "swiping" on some slide with additional <code>NoSwiping</code> element's class</li>
<li><code>.activeSlide</code> became <code>.activeIndex</code></li>
<li><code>.previousSlide</code> became <code>.previousIndex</code></li>
</ul>
</li>
<li>IE9 fix for with in percents</li>
<li>Other minor fixes and improvements</li>
</ul>
<h3>Swiper 1.9.1 - Updated on April 6, 2013</h3>
<ul>
<li>New <a href="http://www.idangero.us/sliders/swiper/api.php">API</a> features:
Expand Down
37 changes: 21 additions & 16 deletions dev/idangerous.swiper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Swiper 1.9.1+ - Mobile Touch Slider
* Swiper 1.9.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: March 16, 2013
* Updated on: April 19, 2013
*/
var Swiper = function (selector, params, callback) {
/*=========================
Expand Down Expand Up @@ -65,7 +65,9 @@ var Swiper = function (selector, params, callback) {
_this.isTouched = false;
_this.realIndex = 0;
_this.activeSlide = 0;
_this.activeIndex = 0;
_this.previousSlide = null;
_this.previousIndex = null;
_this.langDirection = window.getComputedStyle(_this.container, null).getPropertyValue('direction')
/*=========================
New Support Object
Expand Down Expand Up @@ -206,7 +208,7 @@ var Swiper = function (selector, params, callback) {
return index;
}
el.isActive = function () {
if (el.index() == _this.activeSlide) return true;
if (el.index() == _this.activeIndex) return true;
else return false;
}
if (!el.swiperSlideDataStorage) el.swiperSlideDataStorage={};
Expand Down Expand Up @@ -331,7 +333,7 @@ var Swiper = function (selector, params, callback) {

//Currently Active Slide
_this.currentSlide = function () {
return _this.slides[_this.activeSlide]
return _this.slides[_this.activeIndex]
}

/*=========================
Expand Down Expand Up @@ -478,12 +480,14 @@ var Swiper = function (selector, params, callback) {

// Set Initial Slide Position
if(params.initialSlide > 0 && params.initialSlide < numOfSlides && !firstInit) {
_this.realIndex = _this.activeSlide = params.initialSlide;
_this.realIndex = _this.activeIndex = params.initialSlide;

if (params.loop) {
_this.activeSlide = _this.realIndex-params.slidesPerSlide
_this.activeIndex = _this.realIndex-params.slidesPerSlide;
}

//Legacy
_this.activeSlide = _this.activeIndex;
//--
if (isHorizontal) {
_this.positions.current = -params.initialSlide * slideWidth;
_this.setTransform( _this.positions.current, 0, 0);
Expand Down Expand Up @@ -570,7 +574,7 @@ var Swiper = function (selector, params, callback) {
_this.init()
//To fix translate value
if (!params.scrollContainer)
_this.swipeTo(_this.activeSlide, 0, false)
_this.swipeTo(_this.activeIndex, 0, false)
else {
var pos = isHorizontal ? _this.getTranslate('x') : _this.getTranslate('y')
if (pos < -maxPos()) {
Expand Down Expand Up @@ -1311,21 +1315,22 @@ var Swiper = function (selector, params, callback) {
}

_this.updateActiveSlide = function(position) {
_this.previousSlide = _this.realIndex
_this.previousIndex = _this.previousSlide = _this.realIndex
_this.realIndex = Math.round(-position/slideSize)
if (!params.loop) _this.activeSlide = _this.realIndex;
if (!params.loop) _this.activeIndex = _this.realIndex;
else {
_this.activeSlide = _this.realIndex-params.slidesPerSlide
if (_this.activeSlide>=numOfSlides-params.slidesPerSlide*2) {
_this.activeSlide = numOfSlides - params.slidesPerSlide*2 - _this.activeSlide
_this.activeIndex = _this.realIndex-params.slidesPerSlide
if (_this.activeIndex>=numOfSlides-params.slidesPerSlide*2) {
_this.activeIndex = numOfSlides - params.slidesPerSlide*2 - _this.activeIndex
}
if (_this.activeSlide<0) {
_this.activeSlide = numOfSlides - params.slidesPerSlide*2 + _this.activeSlide
if (_this.activeIndex<0) {
_this.activeIndex = numOfSlides - params.slidesPerSlide*2 + _this.activeIndex
}
}
if (_this.realIndex==numOfSlides) _this.realIndex = numOfSlides-1
if (_this.realIndex<0) _this.realIndex = 0

//Legacy
_this.activeSlide = _this.activeIndex;
//Update Pagination
if (params.pagination) {
_this.updatePagination()
Expand Down
Loading

0 comments on commit 99218d1

Please sign in to comment.