Reply To: How to embed You Tube video in Pinboard

#21355
BostonMYP
Participant

Hello,

I’m having a hard time uploading YouTube videos to my site. Once I upload more than one they are attached to each other with no space in between. I tried using the below code but nothing works. I am no coder by any stretch of the imagination. Any help would be greatly appreciated.

$(function() {

var $allVideos = $(“iframe[src^=’//player.vimeo.com’], iframe[src^=’//www.youtube.com’], object, embed”),
$fluidEl = $(“figure”);

$allVideos.each(function() {

$(this)
// jQuery .data does not work on object/embed elements
.attr(‘data-aspectRatio’, this.height / this.width)
.removeAttr(‘height’)
.removeAttr(‘width’);

});

$(window).resize(function() {

var newWidth = $fluidEl.width();
$allVideos.each(function() {

var $el = $(this);
$el
.width(newWidth)
.height(newWidth * $el.attr(‘data-aspectRatio’));

});

}).resize();

});