Use-case
- a view selects 8 most recent photos and uses a jcarousel display with Ajax to load additional photos on demand.
- Photo image fields are displayed as thumbnail with Lightbox link to original (grouped).
- when user clicks on thumbnail, all images are loaded into the Lightbox viewer.
Issue
- additional nodes fetched via Drupal.jcarousel.ajaxLoadCallback have the correct rel attribute on the anchor tag to trigger Lightbox, but since Lightbox has already been initialized (at page load), it ignores those new data items.
- end-user experience is dis-orienting: clicking on one of the 8 "original" thumbnails triggers Lightbox (but only for those 8 originals), but clicking on one of the "additional" thumbnails directs the user to its node url.
Proposal
- Add Lightbox support to jcarousel
- when Drupal.jcarousel.ajaxResponseCallback is triggered (on completing Ajax fetch), check if Lightbox is enabled and if so, re-initialize it.
Hack Attack
- the attached patch works for my particular use-case
- but I've very little experience working with Lightbox or jcarousel, so this patch is probably pretty crude - seems like using a sledgehammer where a feather duster would do.
- was hoping to get some feedback and see if others are interested in this functionality, or perhaps I'm missing something and there is already a way to do this.
Any ideas about how to do this more elegantly would be appreciated.
I'll a better patch or pull request if it seems worthwhile.
| Comment | File | Size | Author |
|---|---|---|---|
| jcarousel_lightbox_support.patch | 458 bytes | jfall |
Comments
Comment #1
quicksketchComment #2
chris pergantis commentedHow about moving this forward as a separate or sub module? Would anyone be interested?