Forum Discussion

ScottVanDeKe938's avatar
ScottVanDeKe938
Community Member
11 months ago

Hide default close button in lightbox slide

I am trying to hide the default close button on the lightbox slide.  I've been using this javascript that I got from a post from 3 years ago (https://community.articulate.com/discussions/articulate-storyline/default-close-button-of-lightbox). 

document.getElementById('light-box-close').style.display = "none";

Previously when I used it, it worked like a charm.  Now I cannot get it to work.  Thinking maybe something changed with the close button reference ID in the latest update, but not sure.

  • Maybe, it would also be great if there was an option within Storyline to remove this button. We use the following Javascript to achieve the above:


  • Scott,

    Additional information while you wait for someone who can provide an additional perspective.

    Richard

    ====

    I tested the following on Edge and Chrome using the latest version of Storyline 360 (modern player), and it still removes the close button on the lightbox slide.

    The inspector still shows it as: 

    document.getElementById("light-box-close").style.display = "none";

    /*This code needs to be placed on any slides being Lightboxed
    to hide the default close button*/

  • if (document.getElementsByClassName("lightbox-close-btn-floating").length > 0) {
      document.getElementsByClassName("lightbox-close-btn-floating")[0].style.display = "none";
    }

  • Hi Barbara. When I use the code above, all the slides are reduced in size after I exit using my own close button. Does that happen to you too?

    • BarbaraJacobs-1's avatar
      BarbaraJacobs-1
      Community Member

      Hi Stephanie.  No, I don't have that issue.  The boxes open up properly in a lightbox and close properly with a close button (Close Lightbox).