-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexamples.html
115 lines (113 loc) · 4.17 KB
/
examples.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Keyboard Shortcut</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="//cdn.rawgit.com/mqxdev/keyboard-shortcut/master/keyboardShortcut.js"></script>
<script>
$(document).ready(function(){
/*
Quando uma tecla e pressionada
*/
$(document).keydown(function( e ){
// Alerta
keyboardShortcut(
{
selector: e,
key: 'a'
},function() {
alert('Alerta do atalho')
}
)
// Help
keyboardShortcut(
{
selector: e,
key: 'i',
ctrl: true
},function() {
$('#myModal').modal('show');
}
)
})
})
</script>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">keyboard-shortcut</a>
</div>
</div><!-- /.container-fluid -->
</nav>
<div class="container">
<h1>Keyboard Shortcut</h1>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Key: <b>F2</b> <span class="text-danger">Internal</span></h3>
</div>
<div class="panel-body">
Enable and Disable function keyboard shortcut.
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Key: <b>F4</b> <span class="text-danger">Internal</span></h3>
</div>
<div class="panel-body">
Enable and Disable function debug.
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Key: <b>a</b></h3>
</div>
<div class="panel-body">
Show alert.
<div>
<script async src="https://jsfiddle.net/aronpc/3k7314L6/embed/js,resources/"></script>
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Key: <b>Ctrl + i</b></h3>
</div>
<div class="panel-body">
Open modal for info.
<div>
<script async src="https://jsfiddle.net/aronpc/cbn3s11o/embed/js,resources/"></script>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel" style="text-align:center;"><i class="glyphicon glyphicon-alert" style="color: #ff4f3d"></i> MODAL</h4>
</div>
<div class="modal-body" style="text-align:center;">
Modal chamado pelo comando Ctrl + i
</div>
<div class="modal-footer" >
<button type="button" class="btn btn-primary">Entendi</button>
</div>
</div>
</div>
</div>
</body>
</html>