Skip to content

Instantly share code, notes, and snippets.

@sasha240100
Created June 19, 2018 20:33
Show Gist options
  • Save sasha240100/eb1dc437e2adbb1d37dd97528d8ce34a to your computer and use it in GitHub Desktop.
Save sasha240100/eb1dc437e2adbb1d37dd97528d8ce34a to your computer and use it in GitHub Desktop.
const VIDEOS = {
video1: 'https://www.youtube.com/embed/LPcBH7kUWhY?rel=0&showinfo=0&autoplay=1',
video2: 'https://www.youtube.com/embed/LPcBH7kUWhY?rel=0&showinfo=0&autoplay=1',
video3: 'https://www.youtube.com/embed/LPcBH7kUWhY?rel=0&showinfo=0&autoplay=1',
video4: 'https://www.youtube.com/embed/LPcBH7kUWhY?rel=0&showinfo=0&autoplay=1',
video5: 'https://www.youtube.com/embed/LPcBH7kUWhY?rel=0&showinfo=0&autoplay=1',
video6: 'https://www.youtube.com/embed/LPcBH7kUWhY?rel=0&showinfo=0&autoplay=1'
};
function insertIframe() {
const activeSlide = $('.slider2 .tns-slide-active .video');
if (activeSlide.querySelectorAll(':scope > iframe').length < 1) {
activeSlide.innerHTML = `
<iframe
width="560"
height="400"
src="${VIDEOS[activeSlide.id]}"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
></iframe>
`;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment