English  Italiano  Français  Español  Dansk  Deutsch  Deutsch  Português  Suomi 
Video Lightbox

Does video lightbox jquery provide compatibility with dynamically generated links?

Sep 05, 2012

Q: This problem is a little involved, but I hope you can help me. A client of ours is attempting to use VideoLightBox on their website. They've implemented it and it works well on it's own. However, they wish to use it in conjunction with some Javascript that filters a list of <div>s, a feat it accomplishes by removing all of the <div>s from the page and then reinserting the appropriate ones. When the page is first loaded, the Lightbox works as it should. However, once a <div> is removed and reinserted, the Lightbox does not work (it simply acts as a normal link to the video) though the HTML of the <div> itself appears identical before and after the filtering. I assume this means that your Javascript applies itself to the appropriate links at page load. How might I go about fixing it?

A: After your script generates links dynamically, you should call VideoLightBox gallery manually. So, you should add following line in your script:

videoLightBox(".voverlay");


Also, you call VideoLightBox scripts one more time after links update. It's not necessary. They were called during page load. You need just add the line above.

Related