Skip to content

Commit

Permalink
Merge pull request #19 from aaronroberson/master
Browse files Browse the repository at this point in the history
Add support for scrollbar and wrapperClass
  • Loading branch information
ksachdeva committed Dec 4, 2015
2 parents 4c6eb51 + 313455b commit 8317b9b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
aaronroberson:[email protected]
angular:[email protected]_1
[email protected]
swiper:[email protected]
[email protected]
2 changes: 1 addition & 1 deletion dist/angular-swiper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var packageName = 'aaronroberson:angular-swiper';
var where = 'client';
var version = '0.3.1';
var summary = 'Angular directive for iDangero.us Swiper re-packaged for Meteor.';
var gitLink = 'https://github.com/aaronroberson/angular-swiper';
var documentationFile = 'README.md';

// Meta-data
Package.describe({
name: packageName,
version: version,
summary: summary,
git: gitLink,
documentation: documentationFile
});

Package.onUse(function(api) {
api.versionsFrom(['[email protected]', '[email protected]']);

api.use('angular:[email protected]', where);
api.use('swiper:[email protected]', where);

api.addFiles('dist/angular-swiper.js', where);
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "angular-swiper",
"version": "0.3.0",
"description": "Angular directive for nolimits4web/swiper",
"main": "index.js",
"main": "dist/angular-swiper.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down
18 changes: 13 additions & 5 deletions src/angular-swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@
paginationIsActive: '=',
paginationClickable: '=',
showNavButtons: '=',
showScrollBar: '=',
loop: '=',
autoplay: '=',
initialSlide: '=',
containerCls: '@',
wrapperCls: '@',
paginationCls: '@',
slideCls: '@',
direction: '@',
swiper: '=',
overrideParameters: '='
},
controller: function($scope, $element, $timeout) {
var self = this;
var uuid = createUUID();

$scope.swiper_uuid = uuid;
Expand Down Expand Up @@ -81,12 +82,14 @@
params.prevButton = '#prevButton-' + $scope.swiper_uuid;
}

if ($scope.showScrollBar === true) {
params.scrollbar = '#scrollBar-' + $scope.swiper_uuid;
}

if ($scope.overrideParameters) {
params = angular.extend({}, params, $scope.overrideParameters);
}

var containerCls = $scope.containerCls || '';

$timeout(function() {
var swiper = null;

Expand All @@ -106,13 +109,14 @@
});
},

link: function(scope, element, attrs) {
link: function(scope, element) {

var uuid = scope.swiper_uuid;

var paginatorId = "paginator-" + uuid;
var prevButtonId = "prevButton-" + uuid;
var nextButtonId = "nextButton-" + uuid;
var scrollBarId = 'scrollBar-' + uuid;

var containerElement = element[0];

Expand All @@ -124,14 +128,18 @@

angular.element(containerElement.querySelector('.swiper-button-prev'))
.attr('id', prevButtonId);

angular.element(element[0].querySelector('.swiper-scrollbar'))
.attr('id', scrollBarId);
},

template: '<div class="swiper-container {{containerCls}}">' +
'<div class="parallax-bg" data-swiper-parallax="{{parallaxTransition}}" ng-show="parallax"></div>' +
'<div class="swiper-wrapper" ng-transclude></div>' +
'<div class="swiper-wrapper {{wrapperCls}}" ng-transclude></div>' +
'<div class="swiper-pagination {{paginationCls}}"></div>' +
'<div class="swiper-button-next" ng-show="showNavButtons"></div>' +
'<div class="swiper-button-prev" ng-show="showNavButtons"></div>' +
'<div class="swiper-scrollbar" ng-show="showScrollBar"></div>' +
'</div>'
};
}
Expand Down

0 comments on commit 8317b9b

Please sign in to comment.