Shadowbox and javascript controlled links

Reading time ~1 minute

Recently I have started using Michael J. I. Jackson’s Shadowbox.js on some of my client’s sites. On site in particular had an image gallery where you could click on a thumbnail to view a larger version of the image, and some had associated videos as well.

The goal there was to have a single link that would be updated to point to the correct flash video depending on the thumbnail being clicked (the link being hidden if no video was associated with that thumbnail). After a few frustrated minutes, I discovered that Shadowbox.setup() needs to be called after changing the link’s href attribute so that the link will trigger the correct video. Since the initially the link didn’t point to a video at all, I also passed {skipSetup: true} to Shadowbox.init().

How I'm starting my React apps now

tl;dr, clone []( IntroductionFor this setup, I have node v...… Continue reading

Tin Khan

Published on October 03, 2016

A Comeback for Another Drink

Published on September 25, 2016