You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Note: In the dist folder we have available iffe, umd and es versions as well as minified \*.min.js versions
@@ -36,7 +36,7 @@ See the demo - [example](https://tomik23.github.io/zooom.js/)
36
36
37
37
## How to add basic version to page
38
38
39
-
1. Just download the library from the `dist/zoom.min.js` and add it to head.
39
+
1. Just download the library from the `dist/zoom.min.js` and add it to head. Libraries in iffe, umd, esm and IE compatible library are available.
40
40
41
41
```html
42
42
<scriptsrc="path/to/zooom.min.js"></script>
@@ -52,8 +52,8 @@ See the demo - [example](https://tomik23.github.io/zooom.js/)
52
52
53
53
```html
54
54
<script>
55
-
window.addEventListener('DOMContentLoaded', function () {
56
-
newZooom('img-zoom');
55
+
window.addEventListener("DOMContentLoaded", function () {
56
+
newZooom("img-zoom");
57
57
});
58
58
</script>
59
59
```
@@ -93,8 +93,7 @@ npm run prod
93
93
| zIndex | Number |`1`|| Option to control layer positions |
94
94
| animationTime | Number |`300`|| Animation speed in milliseconds |
95
95
| in / out | String |`zoom-in / zoom-out`|| The cursor property specifies the mouse cursor to be displayed when pointing over an element |
96
-
| color | String |`#fff`|| Overlay layer color, hex only |
97
-
| opacity | Number |`100`|| Overlay layer opacity, number must be an integer, maximum number 100 |
96
+
| overlay | String ||| Overlay layer color and opacity `rgba(255,255,255,0.9);` or `hsla(0, 0%, 100%, 0.9);`|
98
97
| data-zooom-big | string ||| The large version of the photo is the views instead of the thumbnail |
99
98
| onResize | Function ||| A function that can be used to block clicking on an image. See example below - How to prevent zoom-in/out images |
100
99
| onOpen | Function ||| A helper function with which we can, for example, add text from the caption to the photo to show when zooming in on the photo. In the function we have access to the image element |
@@ -103,31 +102,27 @@ npm run prod
103
102
## Minimal configuration
104
103
105
104
```javascript
106
-
newZooom('img-zoom');
105
+
newZooom("img-zoom");
107
106
```
108
107
109
108
## Sample configuration
110
109
111
110
```javascript
112
-
newZooom('img-zoom', {
111
+
newZooom("img-zoom", {
112
+
// control layer positions
113
113
zIndex:9,
114
114
115
115
// animation time in number
116
116
animationTime:300,
117
117
118
118
// cursor type
119
119
cursor: {
120
-
in:'zoom-in',
121
-
out:'zoom-out',
120
+
in:"zoom-in",
121
+
out:"zoom-out",
122
122
},
123
123
124
-
overlay: {
125
-
// hex or color-name
126
-
color:'#fff',
127
-
128
-
// [10, 20, 34, ..., 100] maximum number 100
129
-
opacity:80,
130
-
},
124
+
// overlay layer color and opacity, rgba, hsla, ...
125
+
overlay:"rgba(255,255,255,0.9)",
131
126
132
127
// callback function
133
128
// see usage example docs/index.html
@@ -142,35 +137,31 @@ new Zooom('img-zoom', {
142
137
See an [example](https://codepen.io/Tomik23/full/VwPmLqX)
143
138
144
139
```javascript
145
-
newZooom('img-zoom', {
140
+
newZooom("img-zoom", {
146
141
zIndex:9,
147
142
148
143
// animation time in number
149
144
animationTime:300,
150
145
151
146
// cursor type
152
147
cursor: {
153
-
in:'zoom-in',
154
-
out:'zoom-out',
148
+
in:"zoom-in",
149
+
out:"zoom-out",
155
150
},
156
-
overlay: {
157
-
// hex or color-name
158
-
color:'#fff',
159
151
160
-
// [10, 20, 34, ..., 100] maximum number 100
161
-
opacity:80,
162
-
},
152
+
// overlay layer color and opacity, rgba, hsla, ...
153
+
overlay:"rgba(255,255,255,0.9)",
163
154
164
155
// callback function
165
156
// see usage example docs/index.html
166
157
onOpen:function (element) {
167
158
// we stop automatic scrolling when we do zoom images
168
-
$('.carousel').carousel('pause');
159
+
$(".carousel").carousel("pause");
169
160
},
170
161
171
162
onClose:function (element) {
172
163
// we restart the carousels after closing the photo
173
-
$('.carousel').carousel('cycle');
164
+
$(".carousel").carousel("cycle");
174
165
},
175
166
});
176
167
```
@@ -181,14 +172,14 @@ Below is an example showing how to block a click when the browser width is less
181
172
Of course, here is an example with the width of the window, but nothing prevents you from using it in a different way. The most important thing is to return the logical value - `true/false`. Each `reduction/reduction` of the window reads this variable and blocks the click.
182
173
183
174
```javascript
184
-
newZooom('img-zoom', {
175
+
newZooom("img-zoom", {
185
176
// we set different types of cursor depending on
186
177
// the width of the window below we pass
187
178
// the variables for the cursor styles set
188
179
// dynamically in the calback onResize function
189
180
cursor: {
190
-
in:'var(--zoom-in)',
191
-
out:'var(--zoom-out)',
181
+
in:"var(--zoom-in)",
182
+
out:"var(--zoom-out)",
192
183
},
193
184
onResize:function () {
194
185
// we set the page width from which it will
@@ -207,8 +198,8 @@ new Zooom('img-zoom', {
207
198
208
199
// I set different cursors depending on the width of the window
0 commit comments