-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathngslider.js
56 lines (50 loc) · 2.23 KB
/
ngslider.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
angular.module("ngSlide",[])
.directive("slider",['$timeout',function($timeout){
return{
restrict: 'A',
replace: true,
scope:{
id: '@id',
effect: '@effect',
delayTime: "@delayTime",
interTime: '@interTime',
defaultIndex: '@defaultIndex',
titCell: '@titCell',
trigger: '@trigger',
scroll: '@scroll',
vis: '@vis',
titOnClassName: '@titOnClassName',
autoPage: '@autoPage',
prevCell: '@prevCell',
nextCell: '@nextCell'
},
transclude:true,
template:"" +
"<div class='cc tibooslider'>" +
'<ul class="cc" ng-transclude id="{{ ulid }}"></ul>' +
"</div>",
//templateUrl: 'slider.html' (if you have localhost)
link:function(scope,elem,attrs){
scope.ulid = scope.id + "ul";
var id = "#" + scope.id;
var ulid = id + "ul",
autoPlay = scope.autoPlay || true,
effect = scope.effect || "fade",
delayTime = scope.delayTime || 500,
interTime = scope.interTime || 2500,
defaultIndex = scope.defaultIndex || 0,
titCell = scope.titCell || ".hd li",
trigger = scope.trigger || "mouseover",
scroll = scope.scroll || 1,
vis = scope.vis || 1,
titOnClassName = titOnClassName || "on",
autoPage = autoPage || false,
prevCell = ".prev",
nextCell = ".next";
$timeout(function(){
$(id).slide({autoPlay:autoPlay,mainCell:ulid});
$timeout.cancel();
})
}
}
}])