-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
61 lines (55 loc) · 1.73 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
<!DOCTYPE html>
<html>
<head>
<style>
.my-container { width: 100vw; height: 66vh; margin-top: 150vh;}
.my-responsive-image {
display:block;
width:100%;
height:100%;
background-size: contain; /* note: to make image crop to fill the frame use: cover; */
background-repeat: no-repeat;
background-position: center center;
}
img { height: 30vh; }
/* optional classes for placeholder style and loading effects.
.flying-fish-loaded class is added to element when image is loaded
so in this example the images quickly fades in once loaded.
*/
.flying-fish { opacity:0; transition: opacity .3s; }
.flying-fish-loaded { opacity: 1; }
</style>
</head>
<body>
<p>
Scroll Down to load images below the fold
</p>
<div class="my-container">
<p>Image tag</p>
<img data-sargasso-class="FlyingFish" data-src="https://raw.githubusercontent.com/PelagicCreatures/flyingfish/master/test.jpg" class="flying-fish">
</div>
<p>
Scroll more.
</p>
<div class="my-container">
<p>Responsive background image</p>
<sargasso-flying-fish class="my-responsive-image flying-fish" data-src="https://raw.githubusercontent.com/PelagicCreatures/flyingfish/master/test.jpg"></sargasso-flying-fish>
</div>
<script async src="https://unpkg.com/es-module-shims@0.13.1/dist/es-module-shims.js"></script>
<script type="importmap">
{
"imports": {
"@pelagiccreatures/sargasso": "https://unpkg.com/@pelagiccreatures/sargasso@2.0.0/dist/sargasso.mjs",
"@pelagiccreatures/flyingfish": "/dist/flyingfish.mjs"
}
}
</script>
<script type="module">
import { utils } from "@pelagiccreatures/sargasso"
import { FlyingFish } from "@pelagiccreatures/flyingfish"
window.onload = () => {
utils.bootSargasso()
}
</script>
</body>
</html>