-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
187 lines (168 loc) · 5.19 KB
/
example.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<html>
<head>
<title>Tour</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="build/build.css" type="text/css">
<style>
body {
padding: 4em;
background-color: #FFDC00;
}
.tip-inner {
background-color: rgba(0,0,0,.75);
color: #fff;
padding: 2px;
text-align: center;
}
.tip-arrow {
position: absolute;
width: 0;
height: 0;
line-height: 0;
border: 5px dashed rgba(0,0,0,.75);
}
.tip-arrow-top { border-top-color: rgba(0,0,0,.75) }
.tip-arrow-bottom { border-bottom-color: rgba(0,0,0,.75) }
.tip-arrow-left { border-left-color: rgba(0,0,0,.75) }
.tip-arrow-right { border-right-color: rgba(0,0,0,.75) }
.tip-top .tip-arrow,
.tip-top-left .tip-arrow,
.tip-top-right .tip-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-top-style: solid;
border-bottom: none;
border-left-color: transparent;
border-right-color: transparent
}
.tip-bottom .tip-arrow,
.tip-bottom-left .tip-arrow,
.tip-bottom-right .tip-arrow {
top: 0px;
left: 50%;
margin-left: -5px;
border-bottom-style: solid;
border-top: none;
border-left-color: transparent;
border-right-color: transparent
}
.tip-left .tip-arrow {
right: 0;
top: 50%;
margin-top: -5px;
border-left-style: solid;
border-right: none;
border-top-color: transparent;
border-bottom-color: transparent
}
.tip-right .tip-arrow {
left: 0;
top: 50%;
margin-top: -5px;
border-right-style: solid;
border-left: none;
border-top-color: transparent;
border-bottom-color: transparent
}
.overlay.tour-overlay {
background-color: rgba(255, 255, 255, .3);
}
.hidden {
display: none;
}
[data-tour-id="button"] {
display: block;
float: right;
}
.flowers {
display: block;
clear: both;
margin: 3em auto;
transition: all .3s ease-in-out;
width: 288px;
}
.flowers.big {
width: 100px;
}
.flowers.tour-active-step {
-webkit-filter: grayscale(100%);
box-shadow: 0 0 15px black;
}
[data-tour-id="text"] {
display: block;
width: 30%;
padding: 1em;
background-color: rgba(255, 255, 255, .8);
}
.buttons button {
font-size: 1rem;
}
.tour-popover .popover-content {
background-color: chocolate;
}
.tour-popover.tour-reacted .before {
display: none;
}
.tour-popover:not(.tour-reacted) .after {
display: none;
}
.status {
position: absolute;
right: 0;
bottom: 0;
margin: 1em;
padding: 1em;
background-color: black;
color: white;
font-weight: bold;
}
</style>
</head>
<body>
<div class='buttons'>
<button class="start">Click to Start Tour</button>
<button class="start-overlay">Click to Start Tour with Overlay</button>
</div>
<input data-tour-id="button" type="submit" value="Important button"></input>
<img class="flowers" src='https://lh3.googleusercontent.com/-ndFbEVL6ZsQ/UqUV6v5XWvI/AAAAAAAAfnw/_4FYnvUYMDU/s288/P1400253.JPG'>
<p data-tour-id="text">
Id eros vidit pri. Ad amet explicari vel. Cum ne patrioque voluptatum, sed mutat facilisi no. Quem detraxit has at, nec at wisi signiferumque, ea sit amet legimus. Erat munere accusam ne sed, an eos delenit inermis omittantur.
</p>
<p class="status"></p>
<template id='example-tour'>
<span data-tour-content="button">This is how we start the tour.</span>
<div data-tour-content=".flowers" data-position="left" data-delay="100">
<p class='before'>Try clicking on this photo. It should change its size.</p>
<p class='after'><em>Good job!</em></p>
</div>
<div data-tour-content="text" data-position="top">
And that is the last element...
</div>
</template>
<script src="build/build.js"></script>
<script>
var customLabels = { cancel: 'Got it!' };
var tour = new Tour('#example-tour', { labels: customLabels });
document.querySelector('.start').addEventListener('click', function() {
tour.play();
});
document.querySelector('.flowers').addEventListener('click', function(e) {
tour.react(300);
e.target.classList.toggle('big');
});
document.querySelector('.start-overlay').addEventListener('click', function() {
Tour.of('#example-tour').overlay().play();
});
tour.on('next', function(index) {
document.querySelector('.status').textContent = 'Next step: ' + index;
});
tour.on('begin', function() {
document.querySelector('.status').textContent = 'Tour started';
});
tour.on('end', function() {
document.querySelector('.status').textContent = 'Tour completed';
});
</script>
</body>
</html>