-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
33 lines (25 loc) · 774 Bytes
/
app.js
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
console.log(window["PictureJS"])
// Creating a lens
const lens = new PictureJS.Lens(
(window.innerWidth / 2) * 0.25, // Width
(window.innerWidth / 2) * 0.25, // Height
);
// Editing the config of the lens, and changing the output element
lens.config.outputOnto(
document.querySelector('.preview') // The output element
);
// Creating a zoomable image
const image = new PictureJS.Image(
`https://picsum.photos/${window.innerWidth/2}/${window.innerHeight}` // Url
);
// Setting the parent element of @image
image.setParent('.container');
// Events avaliable
// : 'load'
// .on function to listen for load events
image.on(
'load', // Event name
() => console.log("Image Loaded...") // Callback
);
// Loading the lens
image.lens.loadCustomLens(lens);