-
Notifications
You must be signed in to change notification settings - Fork 2
/
work.html
129 lines (86 loc) · 3.27 KB
/
work.html
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!doctype html>
<html ng-app="App">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<title>Tabs-Menu (MaterializeCss) with suport touch/Drag (Angular 1.x)</title>
<link rel='shortcut icon' href="icon2.png">
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/css/materialize.min.css">
<style type="text/css">
.full-pg{
height: 400px;
}
</style>
</head>
<body >
<div class="container" ng-controller="ctrl">
<div class="row">
<div class="col s12">
<ul class="tabs">
<li class="tab col s3"><a href="#recados">Recados (1)</a></li>
<li class="tab col s3"><a class="active" href="#avisos">Avisos (2)</a></li>
<li class="tab col s3"><a href="#eventos">Eventos(3)</a></li>
</ul>
</div>
<div id="recados" class="col s12 full-pg" ng-swipe-right="moveToRight(this)" ng-swipe-left="moveToLeft(this)">Test 1</div>
<div id="avisos" class="col s12 full-pg" ng-swipe-right="moveToRight(this)" ng-swipe-left="moveToLeft(this)">Test 2</div>
<div id="eventos" class="col s12 full-pg" ng-swipe-right="moveToRight(this)" ng-swipe-left="moveToLeft(this)">Test 4</div>
</div>
</div>
<script type="text/javascript" src="node_modules/angular/angular.js"></script>
<script type="text/javascript" src="node_modules/angular-touch/angular-touch.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/js/materialize.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('ul.tabs').tabs();
});
/*
var positionActual = 0;
var menusArr = [];
$( "#menu-modulos li a" ).each(function(i) {
var auxHref = $(this).attr('href');
menusArr.push(auxHref);
});
*/
var positionActual = 0;
var menusArr = ["recados", "avisos", "eventos"];
angular.module('App', ['ngTouch'])
.controller('ctrl', ['$scope', function($scope) {
$scope.moveToLeft = function ($event) {
console.log('Movendo para a Esquerda');
var el = event.target;
var idAtualEl = $(el).attr('id');
var indexOfMenu = menusArr.indexOf(idAtualEl);
if(indexOfMenu - 1 == menusArr.length){
return false;
}
positionActual = positionActual - 1;
var mv = menusArr[indexOfMenu - 1];
$('ul.tabs').tabs('select_tab', mv);
}
$scope.moveToRight = function ($event) {
console.log('Movendo para a Direita');
var el = event.target;
console.log(el);
var idAtualEl = $(el).attr('id');
var indexOfMenu = menusArr.indexOf(idAtualEl);
//console.log(idAtualEl);
console.log(indexOfMenu);
/*
if(indexOfMenu + 1 == menusArr.length){
return false;
}
*/
positionActual = positionActual + 1;
var mv = menusArr[indexOfMenu - 1];
$('ul.tabs').tabs('select_tab', mv);
}
}]);
</script>
</script>
</body>
</html>