forked from aFarkas/lazysizes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
105 lines (99 loc) · 3.67 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
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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>controlling retina/density of responsive images with lazysizes and the optimumx plugin</title>
<link href="../assets/css/tidy.css" rel="stylesheet" />
<style>
.container {
max-width: 1200px;
min-width: 320px;
margin: auto;
padding: 10px;
}
#arena {
display: block;
margin: auto;
border: 1px solid #000;
width: 75%;
height: 720px;
resize: both;
}
form .row {
margin-bottom: 15px;
}
.alert-noretina {
display: none;
}
.no-retina .alert-noretina {
display: block;
}
</style>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="//afarkas.github.io/webshim/js-webshim/minified/polyfiller.js"></script>
<script src="js/parent.js"></script>
</head>
<body>
<div class="container">
<div class="alert alert-info">
<p>The <code>srcset</code> with the <code>sizes</code> attribute is definitely the way to go to create responsive, flexibel, adaptive images.</p>
<p>Unfortunately there is no way to tell the browser, that a specific image doesn't gain much perceived quality with a higher density or that image quality of a specific image isn't important for the user experience.</p>
<p>Due to the fact, that a 2x retina means 4x data and 3x retina means 9x data, performance can suffer even on good connections badly.</p>
<p><a href="https://github.com/aFarkas/lazysizes/tree/gh-pages/plugins/optimumx">lazySizes <code>data-optimumx</code> feature</a> (build on top of <code>data-sizes="auto"</code>) gives the developer more control to use adaptive images markup, but opt-out from to high retina at some point by defining the optimum density.</p>
</div>
<div class="alert alert-danger alert-noretina">
<p>Unfortunately this demo makes only sense, if you are using a retina device. Maybe come back with one (tablet / smartphone)? Sorry!</p>
</div>
<div class="panel panel-default">
<div class="panel-heading">Configure the <code>data-optimumx</code> attribute</div>
<div class="panel-body">
<form role="form" class="arena-config show-activelabeltooltip">
<fieldset>
<legend><code>data-optimumx</code></legend>
<div class="row">
<div class="form-group">
<div class="col-sm-6">
<label for="optimumx">optimumx</label>
<input id="optimumx" name="optimumx" value="1.5" min="1" max="1.9" step="0.1" type="range" />
</div>
</div>
</div>
</fieldset>
<div class="row">
<div class="form-group start-buttons">
<div class="col-sm-4">
<button type="submit" class="btn btn-primary">load config</button>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-primary btn-optimum">load image specific</button>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-primary btn-auto">load with "auto" value</button>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-sm-6">
<label for="viewport">viewport width</label>
<input id="viewport" value="75" min="50" max="100" step="1" type="range" />
</div>
<div class="col-sm-6">
<div class="checkbox">
<label>
<input id="vw-input" type="checkbox" checked=""> oninput / onchange
</label>
</div>
<p class="help-block">Wether viewport should be changed while dragging (input/checked) or on drag release (change/unchecked).</p>
</div>
</div>
</div>
</form>
</div>
</div>
<iframe id="arena"></iframe>
</div>
</body>
</html>