Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10917 closed enhancement (invalid)

clicks on LightBox image

Reported by: hungerburg Owned by: anonymous
Priority: high Milestone: tbd
Component: General Version: 1.4.2
Keywords: Cc:
Blocked By: Blocking:


In order to ease viewing of a sequence of grouped images in a lightbox, I connect to the "onclick" handler of the lightbox image node like this: dojo.connect(lightbox.imgNode, "onclick",lightbox, "_nextImage");

In firefox and IE, this only works with the first image that is shown when the lightbox dialogue pops up. Clicks on the following images will do nothing, as the handler is no longer there, possibly because the image node was swapped and along with it the handler was scrapped. Yet it works in google-chrome - though I dont know why.

Maybe, if you see a use for my case, I suggest to wrap the image in the lightbox's template into another div or span attachPoint, so a handler connected to imgNode.onclick can survive in a browser independet fashion? (Connecting to the image's parent container will shadow clicks on the prev, next and close buttons, so that is not an option.)

Change History (3)

comment:1 in reply to:  description Changed 12 years ago by hungerburg

In the last paragraph above:

so a handler connected to imgNode.onclick can survive ...

I wanted to say, a handler on /thatOtherNode/.onclick can survive the image swap.

comment:2 Changed 12 years ago by dante

Resolution: invalid
Status: newclosed

this is already possible? Both Lightbox and LightboxDialog? have a public onClick registered to the wrapper node around the images, and it does bubble up but filters out the case where an icon was clicked. You can define the onClick handler in the construction of the Lightbox or connect to the instance

var n = new dojox.image.Lightbox({ onClick:.... })
// or
dojo.connect(n, "onClick", function(img){ ... });

the { group:name, href:url } data is passed to the listener.

comment:3 Changed 12 years ago by hungerburg

I see, its uppercas C in onClick - thank you dante! and thank you all the contributors for the dojo goodness :)

Note: See TracTickets for help on using tickets.