Configure and add custom CSS animations
masterGLightbox animations are driven by CSS classes. You define an effect (e.g., zoom) and map it to specific CSS animation names via the cssEfects option.
When an effect is triggered, GLightbox appends a g prefix to the animation name you provided. For example, if you register zoom: { in: 'zoomIn' }, GLightbox will apply the class .gzoomIn to the element.
const glightbox = GLightbox({
openEffect: 'zoom',
closeEffect: 'fade',
cssEfects: {
fade: { in: 'fadeIn', out: 'fadeOut' },
zoom: { in: 'zoomIn', out: 'zoomOut' }
}
});
// Adding a custom animation
const glightbox = GLightbox({
openEffect: 'bounce',
cssEfects: {
bounce: { in: 'bounceIn', out: 'bounceOut' }
}
});