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().

Web Development Coding Sessions on Twitch

Hi! It's been a long time since I've posted here, but I thought anyone that liked my old posts here might appreciate this:I'm excited to ...… Continue reading

How I'm starting my React apps now

Published on January 20, 2018

Tin Khan

Published on October 03, 2016