PDA

View Full Version : Help with Lightbox / OnClick events



robert70
02-18-2013, 10:43 PM
I have a small image rotator on a clients homepgae that displays thumbnails of video content. It has been requested to have the video's load "into" the homepage when a site visitor clicks on a thumbnail. The most elegant solution that jumped to my mind was to use Lightbox to display the videos when clicked (note, some videos are youtube and some are locally hosted on the clients web server).

Due to the image rotator, I find myself needing to use an onclick event to redirect visitors to the video content - a href tags will break the rotator (how handy is that?). It seems that all solutions to this I've found online mandate the a href, but sadly, that is not an option. Anyway, I find myself encountering the problem that onclick doesn't appear to be able to pass the required "rel" tag to lightbox so that the links open in LB. Is there a way to accomplish this?

I'm using Lightbox 2.0.4 (I'm not loyal to this version, and if there is a different or newer version that will let me accomplish my goal, I'm all ears!) the rotator is a modified version of a jquery carousel that - to be honest - I can't even remember where it originated. I am not tied to either solution, I just need a way to cycle through a random amount of images that when clicked will open a related video into a lightbox style solution on the same page. My index is php based, any help or suggestions are greatly appreciated! Thanks in advance!

jscheuer1
02-19-2013, 02:02 PM
Lightbox doesn't show videos anyway. Easybox might be what you want:

http://code.google.com/p/easybox/

Unlike Lightbox 2.04, it uses jQuery which should make integrating it to the carousel easier. It also does do YT and Vimeo videos, and iframes which can contain any page - like for a locally hosted video.

It may require a link in it's default form. But it shouldn't be too hard using basic jQuery to make it respond to clicks on other elements. If you need help with that part, let me know.