A lightbox library for images.
🚧 In development
⚙️ Documentation is a work in progress
⚙️ Work in progress
//import
const gv = Gullview.build();
gv.init();
You can pass in a configuration object into the build
method. See configuration.
<div class="gullview"></div>
<div class="gv_src">
<img src="./demo-images/1.jpg" alt="Alt text 1" />
</div>
<div class="gv_src">
<img src="./demo-images/2.jpg" alt="Alt text 2" />
</div>
<div class="gv_src">
<img src="./demo-images/3.jpg" alt="Alt text 3" />
</div>
For markup, there are 3 things needed:
- An empty div element with a class of
gullview
. - Some image cards with a class of
gv_src
.- To customize the class name, see configuration.
- The specified cards should contain an
img
element with asrc
andalt
attribute.
You can customize the look by providing these CSS variables:
--gv-arrow-clr: #fff;
--gv-counter-clr: #fff;
--gv-counter-fs: 1.5rem;
--gv-counter-ff: monospace;
--gv-background: rgba(0, 0, 0, 0.8);
key | value | default |
---|---|---|
config.targetClass | string | "gv_src" |
The lightbox will grab all elements with the specified class. The class should be on an element wrapping an img
tag.
Example:
<div class="gv_src">
<img src="./demo-images/3.jpg" alt="Alt text 3" />
</div>
key | value | default |
---|---|---|
zoom.enabled | boolean | false |
zoom.level | number | 3 |
zoom.preventNative | boolean | true |
Toggles the zoom functionality.
Set the zoom level when a user zoom.
Note: Setting this higher than 3 is not recommended.
When set to true
this will prevent the zooming via the ctrl
shortcut when the lightbox is opened.
This enables the zoom functionality and sets the zoom level to 2x.
Gullview.build({
zoom: {
enabled: true,
level: 2,
},
}).init();
Display represents the main img element showns in the lightbox.
key | value | default |
---|---|---|
display.animation.enabled | boolean | false |
display.animation.duration | number | false |
display.animation.keyframes_next | string | "gv_display_next" |
display.animation.keyframes_prev | string | "gv_display_prev" |
display.animation.morph.enabled | boolean | false |
display.animation.morph.duration | number | false |
This toggles the an
This specifies the "prev" and "next animation duration.
You can pass in custom CSS keyframes name to be used for the "prev" and "next" animation.
You can enable images to "morph" from their original position with morph.enabled
.
The duration can also be passed in as morph.duration
.
This is an example all the display animations enabled.
Gullview.build({
display: {
animation: {
enabled: true,
morph: { enabled: true },
},
},
}).init();
This in and optional component that provides a count the image's total and the current image.
key | value | default |
---|---|---|
counter.enabled | boolean | false |
counter.animation.duration | number | false |
⚙️Work in progress