Giter Club home page Giter Club logo

Comments (1)

petertenhoor avatar petertenhoor commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.