Skip to content

Commit d6be08b

Browse files
Merge pull request #38 from tomik23:ie-version
build: IE-version
2 parents 75d88c9 + 448bbad commit d6be08b

22 files changed

+1221
-1155
lines changed

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"semi": true,
3-
"singleQuote": true,
3+
"singleQuote": false,
44
"tabWidth": 2,
55
"endOfLine": "auto",
66
"printWidth": 80

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
## v1.1.1 (2022-02-02)
2+
3+
### Added
4+
5+
- generating a separate file for IE browser, rollup.config - typescript target [es6, es5]
6+
7+
### Changed
8+
9+
- simplification of the 'overlay' styling
10+
11+
```js
12+
overlay: {
13+
color: '#fff',
14+
opacity: 80,
15+
},
16+
```
17+
18+
on
19+
20+
```js
21+
// overlay layer color and opacity, rgba, hsla, ...
22+
overlay: "rgba(255, 255, 255, 0.9)",
23+
```
24+
25+
### Build
26+
27+
- adding method and props in 'terser' mangle, adding an undeline `_zooomInit = () => {...}`
28+
29+
```js
30+
terserOptions: {
31+
mangle: {
32+
properties: {
33+
regex: /^_/,
34+
},
35+
},
36+
},
37+
```
38+
39+
> This solution allowed to reduce the library by as much as 23%
40+
141
## v1.1.0 (2022-01-04)
242

343
### Added

README.md

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#### JavaScript
2020

2121
```html
22-
<script src="https://cdn.jsdelivr.net/gh/tomik23/zooom.js@1.1.0/dist/zooom.min.js"></script>
22+
<script src="https://cdn.jsdelivr.net/gh/tomik23/zooom.js@1.1.1/dist/zooom.min.js"></script>
2323
```
2424

2525
> 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/)
3636

3737
## How to add basic version to page
3838

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.
4040

4141
```html
4242
<script src="path/to/zooom.min.js"></script>
@@ -52,8 +52,8 @@ See the demo - [example](https://tomik23.github.io/zooom.js/)
5252

5353
```html
5454
<script>
55-
window.addEventListener('DOMContentLoaded', function () {
56-
new Zooom('img-zoom');
55+
window.addEventListener("DOMContentLoaded", function () {
56+
new Zooom("img-zoom");
5757
});
5858
</script>
5959
```
@@ -93,8 +93,7 @@ npm run prod
9393
| zIndex | Number | `1` | | Option to control layer positions |
9494
| animationTime | Number | `300` | | Animation speed in milliseconds |
9595
| 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);` |
9897
| data-zooom-big | string | | | The large version of the photo is the views instead of the thumbnail |
9998
| onResize | Function | | | A function that can be used to block clicking on an image. See example below - How to prevent zoom-in/out images |
10099
| 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
103102
## Minimal configuration
104103

105104
```javascript
106-
new Zooom('img-zoom');
105+
new Zooom("img-zoom");
107106
```
108107

109108
## Sample configuration
110109

111110
```javascript
112-
new Zooom('img-zoom', {
111+
new Zooom("img-zoom", {
112+
// control layer positions
113113
zIndex: 9,
114114

115115
// animation time in number
116116
animationTime: 300,
117117

118118
// cursor type
119119
cursor: {
120-
in: 'zoom-in',
121-
out: 'zoom-out',
120+
in: "zoom-in",
121+
out: "zoom-out",
122122
},
123123

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)",
131126

132127
// callback function
133128
// see usage example docs/index.html
@@ -142,35 +137,31 @@ new Zooom('img-zoom', {
142137
See an [example](https://codepen.io/Tomik23/full/VwPmLqX)
143138

144139
```javascript
145-
new Zooom('img-zoom', {
140+
new Zooom("img-zoom", {
146141
zIndex: 9,
147142

148143
// animation time in number
149144
animationTime: 300,
150145

151146
// cursor type
152147
cursor: {
153-
in: 'zoom-in',
154-
out: 'zoom-out',
148+
in: "zoom-in",
149+
out: "zoom-out",
155150
},
156-
overlay: {
157-
// hex or color-name
158-
color: '#fff',
159151

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)",
163154

164155
// callback function
165156
// see usage example docs/index.html
166157
onOpen: function (element) {
167158
// we stop automatic scrolling when we do zoom images
168-
$('.carousel').carousel('pause');
159+
$(".carousel").carousel("pause");
169160
},
170161

171162
onClose: function (element) {
172163
// we restart the carousels after closing the photo
173-
$('.carousel').carousel('cycle');
164+
$(".carousel").carousel("cycle");
174165
},
175166
});
176167
```
@@ -181,14 +172,14 @@ Below is an example showing how to block a click when the browser width is less
181172
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.
182173

183174
```javascript
184-
new Zooom('img-zoom', {
175+
new Zooom("img-zoom", {
185176
// we set different types of cursor depending on
186177
// the width of the window below we pass
187178
// the variables for the cursor styles set
188179
// dynamically in the calback onResize function
189180
cursor: {
190-
in: 'var(--zoom-in)',
191-
out: 'var(--zoom-out)',
181+
in: "var(--zoom-in)",
182+
out: "var(--zoom-out)",
192183
},
193184
onResize: function () {
194185
// we set the page width from which it will
@@ -207,8 +198,8 @@ new Zooom('img-zoom', {
207198

208199
// I set different cursors depending on the width of the window
209200
const root = document.documentElement;
210-
root.style.setProperty('--zoom-in', widthWindow ? 'default' : 'zoom-in');
211-
root.style.setProperty('--zoom-out', widthWindow ? 'default' : 'zoom-out');
201+
root.style.setProperty("--zoom-in", widthWindow ? "default" : "zoom-in");
202+
root.style.setProperty("--zoom-out", widthWindow ? "default" : "zoom-out");
212203

213204
return widthWindow;
214205
},
@@ -217,7 +208,18 @@ new Zooom('img-zoom', {
217208

218209
## Browser support
219210

220-
Zooom supports all major browsers including IE 11 and above
211+
Zooom supports all major browsers including IE 11 and above. It also works in the overflow element.
212+
213+
If you want to use [data-zooom-big](https://tomik23.github.io/zooom.js/#large-photo)
214+
on IE browser you have to use polyfill for promise https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js
215+
216+
### local files
217+
218+
- dist/zooom.ie.min.js
219+
220+
### cdn
221+
222+
- https://cdn.jsdelivr.net/gh/tomik23/zooom.js@1.1.1/dist/zooom.ie.min.js
221223

222224
## License
223225

0 commit comments

Comments
 (0)