Droplets - Images & Video

Sorry, this page is only available in one language

YouTube (Responsive)

Suggested dropletname: YouTube

Published by: Dev4me

This Droplet will make it simple to add a YouTube video to a page.
Just copy the youtube ID of the video and add it to the Droplet call. No problems with embedded objects in the WYSIWYG editor.

1
2
3
4
5
6
if (!isset($v) || !$v) return true;
$parm = 'modestbranding=1&rel=0&showinfo=1&showsearch=0&theme=dark&hd=1&wmode=opaque';
$returnvalue  = '<div class="vid">';
$returnvalue .= "  <iframe allowfullscreen type='text/html' src='//www.youtube.com/embed/$v?$parm' frameborder='0'></iframe>";
$returnvalue .= '</div>';
return $returnvalue;

Usage:

[[youtube?v={youtubeid}]]

When used in a responsive template add the following CSS to your stylesheet:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
.vid {
    position: relative;
    padding-bottom: 56.25%;
    padding-top: 30px;
    height: 0;
    overflow: hidden;
}
  
.vid iframe,
.vid object,
.vid embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

 



| Overview | Next droplet »