The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Backbox/Lightbox – close on click on image.

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #26459

    Hello everyone

    I’ll try to ask here then – on another javascript forum they didn’t wanna help me.

    I’m completely new to javascript but I managed to "install" the backbox script on my site (only a test site) I got the script from All works fine but I would like to close the image not only by clicking outside of box or at the Close-button – but also by clicking the image itself.

    The orignal script works really well – except for one small thing – when the backbox displays large images – I can’t close them by clicking outside the image on the left and right sides – it only works closing when I click above or under the box.

    Anyway – an internet search gave me this small code which is supposed to work:

    objLightbox.onclick = function(e) { // close Lightbox is user clicks shadow overlay
    if (!e) var e = window.event;
    var clickObj = Event.element(e).id;
    if ( !/(prevLink)|(nextLink)/.test(clickObj) ) {

    And I was wondering if you guys know where to put it in the lightbox.jg file for it to work (or if it even will work at all?) – Or maybe I can change the original code for this to happen (Without adding this new code?)

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.