Comments (1)
It's not pretty, but for now I ended up doing something like this:
if (document.querySelector(".lightbox-trigger") !== null) {
Array.prototype.slice.call(document.querySelectorAll(".lightbox-trigger")).forEach((($lightboxEl) => {
//create luminous instance
new Luminous($lightboxEl, {
sourceAttribute: "href",
caption: $lightboxEl.querySelector("img").getAttribute("alt"),
openTrigger: "click",
closeTrigger: "click",
closeWithEscape: true,
onOpen: () => {
Array.prototype.slice.call(document.querySelectorAll(".lum-lightbox")).forEach(($lumEl) => {
if ($lumEl.querySelector(".lum-close-icon") === null) {
//create close icon
const $closeEl = document.createElement('span')
$closeEl.classList.add("lum-close-icon")
//add close icon to DOM
$lumEl.insertAdjacentElement('beforeend', $closeEl)
}
})
}
})
}))
}
Styling:
.lum-close-icon {
position: absolute;
right: 32px;
top: 32px;
width: 32px;
height: 32px;
transform: rotate(0deg);
transition: .25s ease-in-out transform;
transform-origin: center center;
cursor: pointer;
&:hover {
transform: rotate(90deg);
}
&:before, &:after {
position: absolute;
left: 15px;
content: ' ';
height: 33px;
width: 2px;
background-color: #fff;
}
&:before {
transform: rotate(45deg);
}
&:after {
transform: rotate(-45deg);
}
}
from luminous.
Related Issues (20)
- Separate basic theme and "fullscreen"-esque mode HOT 1
- injectBaseStyles not setting HOT 2
- How to inject captions when using LuminousGallery class HOT 1
- Add option to set caption (suggestion) HOT 2
- I want to give a class name to the enlarged image. HOT 2
- Demo url on documentation leads to 404 error
- Action Required: Fix Renovate Configuration
- is it possible to use luminous in vue.js? HOT 1
- Dependency Dashboard
- Include license in distributed JS HOT 3
- closetrigger? HOT 2
- The image file's height is over when the image is big size HOT 6
- The automated release is failing 🚨
- Keyframe rule ignored due to bad selector. HOT 2
- Small viewport sizes don't scale the image properly HOT 3
- Arrows are not in the vertical center of the image HOT 1
- onChange doesn't work HOT 1
- What is the proper way to import LuminousGallery?
- Direct including a script from CDN (Unpkg, jsDelivr, ...)
- Call for Maintainer(s) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from luminous.