-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
98 lines (81 loc) · 3.76 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div id="app">
<div class="container" style="padding-top: 20px;">
<h1 class="text-center">js-img-magnify</h1>
<div class="text-center"><img src="https://img.shields.io/npm/v/js-img-magnify" alt=""> <img
src="https://img.shields.io/bundlephobia/minzip/js-img-magnify" alt=""></div>
<p class="p-2 text-center">
Pure JavaScript utility enabling magnifying glass effect on an images.
No external dependencies required.
</p>
<div class="mx-auto" style="width: 800px;">
<div class="d-flex ">
<label for="zoom" class="form-label ">zoom:</label>
<input v-model="form.zoom" type="range" class="form-range mx-3" min="1" max="5" id="zoom">
<span>{{form.zoom}}</span>
</div>
<div class="d-flex ">
<label for="width" class="form-label ">width:</label>
<input v-model="form.width" type="range" class="form-range mx-3" min="200" max="500" id="width">
<span>{{form.width}}</span>
</div>
<div class="d-flex ">
<label for="MagnifyDomWidth" class="form-label ">MagnifyDomWidth:</label>
<input v-model="form.MagnifyDomWidth" type="range" class="form-range mx-3" min="50" max="200" id="MagnifyDomWidth">
<span>{{form.MagnifyDomWidth}}</span>
</div>
<div class="d-flex ">
<div class="form-label me-3">MagnifyDomStyles:</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" v-model="useMagnifyDomStyles" id="flexSwitchCheckChecked">
<label class="form-check-label" for="flexSwitchCheckChecked">use</label>
</div>
</div>
<div class="d-flex ">
<div class="form-label me-3">Custom MagnifyDom:</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" v-model="useMagnifyDom" id="useMagnifyDom">
<label class="form-check-label" for="useMagnifyDom">use</label>
</div>
</div>
<div class="d-flex ">
<div class="form-label me-3">magnify allow overflow:</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" v-model="form.overflow" id="overflow">
</div>
</div>
<h2 class="mt-5">code</h2>
<div class="p-2" style="background-color: #f8f9fa;">
<pre>
<code>magnifyImg{
src: '/src/assets/waterDrop.jpg',
zoom: {{this.form.zoom}},
target: document.getElementById('example'),
width: {{form.width}},
MagnifyDomWidth: {{form.MagnifyDomWidth}},{{useMagnifyDomStyles ? `\n MagnifyDomStyles: ${JSON.stringify(form.MagnifyDomStyles)},` : ''}}{{useMagnifyDom ? `\n MagnifyDom: document.getElementById('show'),` : ''}}
overflow: {{form.overflow}}
}</code></pre>
</div>
<h2 class="mt-5">example:</h2>
<div v-if="useMagnifyDom" class="text-center">
<div id="show" style="width: 500px; height: 300px; background-color: beige;" class="d-inline-block"></div>
</div>
<div class="text-center">
<div id="example" class="d-inline-block"></div>
</div>
</div>
<div class="mt-5"></div>
</div>
</div>
<script type="module" src="/src/main.js"></script>
</body>
</html>