-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
75 lines (65 loc) · 3.61 KB
/
index.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
<!doctype html>
<title>tinyfade.js</title>
<meta name="viewport" content="width=device-width">
<script src="tinyfade.js"></script>
<link rel="stylesheet" href="tinyfade.css">
<script src="demo/prism.js"></script>
<link rel="stylesheet" href="demo/prism.css">
<style>
@import url('https://fonts.googleapis.com/css?family=Londrina+Solid|Roboto+Slab|Roboto+Mono');
* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 0; margin: 0; background: #f0f0f0 }
body { padding: 15vh 15px 60px; }
#slider { width: 800px; max-width: 100%; border-radius: 10px; border: 6px solid #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
pre { margin: 25px 0 0 !important; padding: 15px !important; width: 800px; max-width: 100%; white-space: pre-wrap !important; border-radius: 10px; background: #e8e8e8 !important; box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); }
code { font-family: Roboto Mono, monospace !important; font-size: 15px; text-shadow: none !important; white-space: pre-wrap !important; }
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { background: transparent; }
h1 { font-family: Londrina Solid, sans-serif; font-weight: 400; margin: 0 0 15px; padding: 0; font-size: 48px; }
p { font-family: Roboto Slab, serif; text-align: center; margin: 0 0 60px; }
a { color: #06f; }
.tinyfade>div { background: url(https://source.unsplash.com/VdFkSO3uePI/750x500) no-repeat center / cover; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; color: #fff; }
</style>
<h1>Tinyfade.js</h1>
<p>A tiny plain JavaScript library for customizable fully responsive image slideshows.<br><a href="https://github.com/moqmar/tinyfade.js">Show source on GitHub</a></p>
<div id="slider" class="tinyfade">
<img src="https://source.unsplash.com/EBiHUBxuHIE/750x500">
<img src="https://source.unsplash.com/Z0tTnl_eOIo/750x500">
<img src="https://source.unsplash.com/WSFY8g2CJDo/750x500">
<div style="height: 100%; background: #07c"><p style="margin-bottom: 0"><strong style="font-size: 1.2em; display: block; margin-bottom: 10px;">Hello World!</strong>You can now also add text!</p></div>
</div>
<script>
window.tf = new Tinyfade("#slider", 5000, 1000);
</script>
<pre><code class="language-html"><script src="tinyfade.min.js">
<link rel="stylesheet" src="tinyfade.min.css">
<!-- ... -->
<div class="tinyfade">
<img src="https://source.unsplash.com/trvP9JiYC1E/750x500">
<img src="https://source.unsplash.com/Z0tTnl_eOIo/750x500">
<img src="https://source.unsplash.com/WSFY8g2CJDo/750x500">
<!-- only the first element needs a fixed height, everywhere else you can use 100% to match it -->
<div style="height: 100%">Hello World</div>
</div>
<script>
let tf = new Tinyfade(
".tinyfade", // Element
3000, // Interval in milliseconds (-1 for manual mode, default = 5000)
1000 // Animation duration (default = 1000)
);
// Navigate
tf.next();
tf.prev();
let thirdImage = tf.e.getElementsByTagName("img")[2];
tf.goto(thirdImage);
// Control
tf.pause();
tf.continue();
tf.destroy(); // Stop everything and delete references.
// Events
tf.addEventListener("goto", function(current, last) {
console.log("Showing " + current.src + " (last image: " + last.src + ")");
});
// Try it yourself:
// press F12 and access the Tinyfade instance you see above using "tf"
</script>
</code></pre>