Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello everyone,
This is only my second post, but I hope to become much more active on this site. With that introduction out of the way, I am looking for a way to display a videojs element in a lightbox/colorbox. Can anyone point me in the right direction?
Thank you much!
Comments
Comment #1
heshanlkYou should have a look to Colorbox module.
Comment #2
crunk CreditAttribution: crunk commentedI have colorbox installed. I also have videojs installed. I want to know if I can have colorbox display a video instead of displaying another page.
Comment #3
radmacd CreditAttribution: radmacd commentedI'm struggling with the same issue. I have checked out all the documentation I could get my hands on and have not been able to figure it out either.
Could anyone help us out?
Thanks!
Comment #4
crunk CreditAttribution: crunk commentedHey radmacd,
I finally got a satisfactory result using colorbox with inline content and JW Player. I don't know if it will help you, but here is the code of one of my content templates:
You need to simply make sure you have colorbox configured to allow you to manually call it using 'class="colorbox"'
Comment #5
VM CreditAttribution: VM commentedseems to me the above could have been accomplished using the videojs.tpl.php file as well.
Comment #6
arisaves CreditAttribution: arisaves commentedI would be interested to know how to accomplish the above using the videojs.tpl.php file -- could be neater.
Comment #7
VM CreditAttribution: VM commentedby copying the tpl.php file to your theme and adding the necessary class to the HTML that is required by colorbox to do it's thing.
I no longer utilize this module to test and be more specific. Thus some trial and error may be fruitful.
Comment #8
carl.brown CreditAttribution: carl.brown commentedI was playing with this today. In the end, I created a custom tpl.php file and when the file field is out put, I wrapped it in an extra div with a class of 'hide-video'. Code is a little like this:
The class is defined as follows:
Setting it to display:none; was causing some issues once the video was pulled into the colorbox, whereas doing it this way has worked OK so far.
I then created a link to show the video in a colorbox, as follows:
As per the Colorbox docs, you need to have "load inline content in a colorbox" enabled (so that the class 'colorbox-inline' works).
When you view the page, the video is hidden. Clicking the link shows it in a colorbox. Best of all, if you pause the vid, close the colorbox, then click the colorbox link again, the video is still paused where you left it. nice.
Hope this serves as a starting point to anyone having similar problems.
Comment #9
arisaves CreditAttribution: arisaves commentedCarl --
Thank you for sharing your technique. How did you name your tpl file and where did you place it?
Comment #10
darixsabba CreditAttribution: darixsabba commentedi came to a solution for two problem:
multiple different files in video.js and video.js inside colorbox.
When there is only one video, show embed, when there is multiple video show link with colorbox, as Carl suggest. In theme template videojs.tpl.php:
and in style.css:
.video-js-box { height: 0px; overflow: hidden; }