This repository has been archived by the owner on May 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 705
Added functionality which allows to set how many slides will slide on… #368
Open
Ricco1
wants to merge
1
commit into
revolunet:master
Choose a base branch
from
Ricco1:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/** | ||
* Angular Carousel - Mobile friendly touch carousel for AngularJS | ||
* @version v0.3.13 - 2015-06-15 | ||
* @version v0.3.13 - 2015-09-30 | ||
* @link http://revolunet.github.com/angular-carousel | ||
* @author Julien Bouquillon <[email protected]> | ||
* @license MIT License, http://www.opensource.org/licenses/MIT | ||
|
@@ -292,7 +292,8 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach | |
intialState = true, | ||
animating = false, | ||
mouseUpBound = false, | ||
locked = false; | ||
locked = false, | ||
slidesPerClickLimit = parseInt(iAttributes.rnCarouselItemsPerSlide); | ||
|
||
//rn-swipe-disabled =true will only disable swipe events | ||
if(iAttributes.rnSwipeDisabled !== "true") { | ||
|
@@ -329,7 +330,12 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach | |
} | ||
|
||
scope.nextSlide = function(slideOptions) { | ||
var index = scope.carouselIndex + 1; | ||
var index; | ||
if(isNaN(slidesPerClickLimit) === false && currentSlides.length - scope.carouselIndex + slidesPerClickLimit >= slidesPerClickLimit && currentSlides.length/slidesPerClickLimit > 1) { | ||
index = scope.carouselIndex + slidesPerClickLimit; | ||
} else { | ||
index = scope.carouselIndex + 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need in else |
||
} | ||
if (index > currentSlides.length - 1) { | ||
index = 0; | ||
} | ||
|
@@ -339,7 +345,12 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach | |
}; | ||
|
||
scope.prevSlide = function(slideOptions) { | ||
var index = scope.carouselIndex - 1; | ||
var index; | ||
if(isNaN(slidesPerClickLimit) === false && currentSlides.length - scope.carouselIndex + slidesPerClickLimit >= slidesPerClickLimit && currentSlides.length/slidesPerClickLimit > 1) { | ||
index = scope.carouselIndex - slidesPerClickLimit; | ||
} else { | ||
index = scope.carouselIndex - 1; | ||
} | ||
if (index < 0) { | ||
index = currentSlides.length - 1; | ||
} | ||
|
@@ -453,8 +464,15 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach | |
|
||
if (iAttributes.rnCarouselControls!==undefined) { | ||
// dont use a directive for this | ||
var slidesCountInCurrent = isRepeatBased ? scope[repeatCollection.replace('::', '')].length : currentSlides.length; | ||
var noneDividableCarouselItemCount = 1; | ||
if(isNaN(slidesPerClickLimit) === false){ | ||
noneDividableCarouselItemCount = (slidesCountInCurrent%slidesPerClickLimit !== 0 && slidesCountInCurrent/slidesPerClickLimit > 1) ? (slidesCountInCurrent%slidesPerClickLimit) : 1; | ||
} else { | ||
noneDividableCarouselItemCount = 1; | ||
} | ||
var canloop = ((isRepeatBased ? scope[repeatCollection.replace('::', '')].length : currentSlides.length) > 1) ? angular.isDefined(tAttributes['rnCarouselControlsAllowLoop']) : false; | ||
var nextSlideIndexCompareValue = isRepeatBased ? repeatCollection.replace('::', '') + '.length - 1' : currentSlides.length - 1; | ||
var nextSlideIndexCompareValue = isRepeatBased ? repeatCollection.replace('::', '') + '.length - ' + noneDividableCarouselItemCount.toString() : currentSlides.length - 1; | ||
var tpl = '<div class="rn-carousel-controls">\n' + | ||
' <span class="rn-carousel-control rn-carousel-control-prev" ng-click="prevSlide()" ng-if="carouselIndex > 0 || ' + canloop + '"></span>\n' + | ||
' <span class="rn-carousel-control rn-carousel-control-next" ng-click="nextSlide()" ng-if="carouselIndex < ' + nextSlideIndexCompareValue + ' || ' + canloop + '"></span>\n' + | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slidesPerClickLimit = parseInt(iAttributes.rnCarouselItemsPerSlide) || 1;
Also, I'd move it to defaultOptions.