Skip to content

Instantly share code, notes, and snippets.

@vedovelli
Created September 18, 2012 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vedovelli/3742925 to your computer and use it in GitHub Desktop.
Save vedovelli/3742925 to your computer and use it in GitHub Desktop.
Super Simple Slider plugin directive
rialabs.directive('riaSsslider', function(){
return {
restrict: 'A',
link: function link ($scope, $element, $attrs){
var el = jQuery($element),
ng = $scope;
el.children().each(function(index, item){
ng.panes_length.push($(item).data('label') || "");
});
ng.$watch('position', function(newValue){
el.ssslider('navigate',newValue);
});
ng.$watch('prev', function(newValue){
if(newValue != undefined){
el.ssslider('prev');
}
});
ng.$watch('next', function(newValue){
if(newValue != undefined){
el.ssslider('next');
}
});
el.ssslider(ng.config || {});
}
};
})
.controller('CtrlSlider', function($scope){
var ng = $scope;
ng.navigate = function(pos){
ng.position = pos;
};
ng.change_prev = function(){
ng.prev = !ng.prev || false;
};
ng.change_next = function(){
ng.next = !ng.next || false;
};
var init = function(){
ng.position = 0;
ng.panes_length = [];
ng.config = {
orientation:'from_right'
};
}();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment