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.
Dont follow the documentation as it has nothing to do this the way colorbox works in the Drupal Colorbox module. the documentation is straight from the actual colorbox site.
I think the class should read class="colorbox-load" or class="colorbox-inline"
If you are manually just inserting html into a body field of a node, try just class="colorbox-inline". Works for me, though, I can't seem to set the title correctly in the overlay.
jQuery(document).ready(function($){
//Examples of how to assign the ColorBox event to elements
$(".colorbox-youtube").colorbox({iframe:true, innerWidth:480, innerHeight:390});
});
Add the ".colorbox-youtube" class to your links.
ex.
<a class="colorbox-youtube" href="http://www.youtube.com/watch?v=617ANIA5Rqs" title=" We Share Our Mother's Health">Watch Now</a>
you also need to make sure you go into the Colorbox module configuration page and check the extra settings boxes "Enable Colorbox load" and "Enable Colorbox Inline".
Tommy KanekoCreditAttribution: Tommy Kaneko commented
I have made a patch for 7.x Video module which allows you to use Flowplayer with colorbox. It doesn't do any other player at the moment, but I hope someone with more time than I have could adapt the patch to accept other videos - most of the work is done, I think.
I'm using this little piece of javascript to grab the id of the video and create an iframe in colorbox
jQuery(function ($) {
jQuery('.video_youtube').click(function(event) {
var loc = jQuery(this).attr('href');
// looking for the first param to be 'v='
var id = loc.split("?")[1].split("&")[0].split("=")[1];
event.preventDefault();
jQuery.colorbox({html:'<iframe id="vid_frame" width="640" height="360" src="http://www.youtube.com/embed/' + id +'?enablejsapi=1&autoplay=1&rel=0" frameborder="0" allowfullscreen></iframe>'});
});
});
Then just add a link in this format
<a href="http://www.youtube.com/watch?v=iCkYw3cRwLo&feature=youtu.be" class="video_youtube">Click to be cool</a>
I guess that can be optimized with a drupal behaviour
I couldn't figure it out and ended up using a workaround based on the Media module in conjunction the Media Gallery module. The site in question was already making extensive use of these so I was able to get sorted without carrying any additional overhead.
If you'd like to combine this with views, it's worth considering to use a link field for this purpose (how-to). This approach isn't limited to just one particular video platform (like YouTube).
Comments
Comment #1
bryancasler CreditAttribution: bryancasler commentedsame question. I tried the following based off the demo on the colorbox website
But it did not work.
Comment #2
chaloum CreditAttribution: chaloum commentedAnimelion
Dont follow the documentation as it has nothing to do this the way colorbox works in the Drupal Colorbox module. the documentation is straight from the actual colorbox site.
I think the class should read class="colorbox-load" or class="colorbox-inline"
Comment #3
bryancasler CreditAttribution: bryancasler commentedThanks chaloum, I just tried all three of the following but I couldn't get any of them to work
The first one blacks out the whole screen and the second and third give me this error.
http://awesomescreenshot.com/063bddjbe
Comment #4
patrickfgoddard CreditAttribution: patrickfgoddard commentedIf you are manually just inserting html into a body field of a node, try just class="colorbox-inline". Works for me, though, I can't seem to set the title correctly in the overlay.
Comment #5
bryancasler CreditAttribution: bryancasler commentedThanks for the reply thund3rbox, but if I use
The output is
and I still end up with the same "Request unsuccessful:" error.
http://awesomescreenshot.com/063bddjbe
Comment #6
bryancasler CreditAttribution: bryancasler commentedFound a work around for now.
Add the following JS to your theme
Add the ".colorbox-youtube" class to your links.
ex.
Comment #7
drgrittani CreditAttribution: drgrittani commentedThe following works for me.
example page is at http://kendragrittani.com/video
you also need to make sure you go into the Colorbox module configuration page and check the extra settings boxes "Enable Colorbox load" and "Enable Colorbox Inline".
Comment #8
bryancasler CreditAttribution: bryancasler commentedStrange, that works for me.
How did you generate that code, or did you have to construct it manually?
Comment #9
midmood CreditAttribution: midmood commentedI'm interested too, I tried the #7 link and it works.
Trying to manipulate it with my links stops it from working.
How can you build it?
Comment #10
Tommy Kaneko CreditAttribution: Tommy Kaneko commentedI have made a patch for 7.x Video module which allows you to use Flowplayer with colorbox. It doesn't do any other player at the moment, but I hope someone with more time than I have could adapt the patch to accept other videos - most of the work is done, I think.
The patch for the Video module can be found here:
http://drupal.org/node/1155628
Comment #13
bryancasler CreditAttribution: bryancasler commentedCheckout my recent post regarding embedding youtube videos. Feedback welcome.
#1368274: Solved: How to embed Youtube videos
Comment #14
eduserrat CreditAttribution: eduserrat commentedComment #15
eduserrat CreditAttribution: eduserrat commentedThanks ! It worked for me ! ;)
Comment #22
lsolesen CreditAttribution: lsolesen commentedSeems to be resolved.
Comment #25
freebug CreditAttribution: freebug commentedI have been able to play local video files by embedding the flowplayer by the following way:
Hope this helps someone.
Comment #26
jim.applebee CreditAttribution: jim.applebee commentedFreebug, I'm having a hard time getting this to work for me. Can you provide more details? How/where did you load that code?
I'm trying to load/run locally hosted mp4 videos from a hyperlink. Not Youtube video.
Comment #31
rastikko CreditAttribution: rastikko commentedI'm using this little piece of javascript to grab the id of the video and create an iframe in colorbox
Then just add a link in this format
<a href="http://www.youtube.com/watch?v=iCkYw3cRwLo&feature=youtu.be" class="video_youtube">Click to be cool</a>
I guess that can be optimized with a drupal behaviour
Comment #32
MrPaulDriver CreditAttribution: MrPaulDriver commentedI am using the method mentioned at #7 but find that this approach does not work on iPad or Android.
Any ideas out there?
Comment #33
wellsys_world CreditAttribution: wellsys_world commented@MrPaulDriver same issue for me. Did you find out what was causing it?
Comment #34
MrPaulDriver CreditAttribution: MrPaulDriver commented@Wellsy Sorry no.
I couldn't figure it out and ended up using a workaround based on the Media module in conjunction the Media Gallery module. The site in question was already making extensive use of these so I was able to get sorted without carrying any additional overhead.
See www.redlobstermedia.com (home page)
Comment #35
wellsys_world CreditAttribution: wellsys_world commented@MrPaulDriver - OK, thanks.
I ended up hard coding it as a quick fix to use inline iframes which worked - www.livewellderby.co.uk
Comment #36
jordiespuny CreditAttribution: jordiespuny commented#31 works form mi on iPad
thanks
Comment #37
knalstaaf CreditAttribution: knalstaaf commentedIf you'd like to combine this with views, it's worth considering to use a link field for this purpose (how-to). This approach isn't limited to just one particular video platform (like YouTube).