This time I will share jQuery Plugin and tutorial about Draggable & Zoomable Image Lightbox Plugin – jQuery imgbox.js, hope it will help you in programming stack.
imgbox.js is a simple, lightweight jQuery image lightbox plugin that allows the user to zoom and drag the enlarged version of the image.
How to use it:
1. The plugin requires Material Icons for the close icon.
2. Load the minified version of the jQuery imgbox.js plugin after loading jQuery library.
2 |
integrity = "sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT" |
3 |
crossorigin = "anonymous" > |
5 |
< script src = "jquery.imgbox.min.js" ></ script > |
3. Call the function imgbox
on the target image and done.
1 |
< img src = "1.jpg" width = "300px" > |
4. The necessary CSS styles for the image lightbox.
01 |
.material-icons:before { |
02 |
display : inline- block ; |
03 |
font-family : "Material Icons" ; |
08 |
letter-spacing : normal ; |
10 |
-webkit-font-smoothing: antialiased; |
11 |
-moz-osx-font-smoothing: grayscale; |
12 |
text-rendering: optimizeLegibility; |
13 |
-webkit-font-feature-settings: "liga" ; |
14 |
font-feature-settings: "liga" |
17 |
.check-original-image { |
21 |
-webkit-transform: translate 3 d( -50% , 0 , 0 ); |
22 |
transform: translate 3 d( -50% , 0 , 0 ); |
25 |
border : 1px solid #fff ; |
26 |
background-color : rgba( 0 , 0 , 0 ,. 4 ); |
30 |
transition: all 0.25 s; |
33 |
.check-original-image:hover { |
34 |
box-shadow: 0px 0px 10px -2px rgb ( 0 , 0 , 0 ); |
37 |
a.close-original-image { |
42 |
border-top-left-radius: 50% ; |
43 |
border-top-right-radius: 0px ; |
44 |
border-bottom-right-radius: 0px ; |
45 |
border-bottom-left-radius: 50% ; |
46 |
background-color : rgba( 0 , 0 , 0 ,. 6 ); |
47 |
transform: rotate( -50 deg); |
55 |
a.close-original-image:before { |
59 |
transform: rotate( 50 deg); |
60 |
transition: transform 0.5 s; |
63 |
a.close-original-image:hover:before { |
64 |
transform: rotate( 230 deg); |
5. Enable/disable the drag and zoom functionalities.
6. Specify the initial zoom level.
This awesome jQuery plugin is developed by acme-top. For more Advanced Usages, please check the demo page or visit the official website.