ADD portada, backend & styles
This commit is contained in:
@ -1,5 +1,61 @@
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
// jQuery( document ).ready( function( $ ) {
|
||||
// console.log('modal')
|
||||
|
||||
// Your JavaScript goes here
|
||||
// $(document).ready(function () {
|
||||
// const $videoModal = $('#videoModal');
|
||||
// const $modalIframe = $('#modalVideoIframe');
|
||||
// const $modalTitle = $('#videoModalLabel');
|
||||
|
||||
// // Cuando se abre el modal
|
||||
// $videoModal.on('show.bs.modal', function (event) {
|
||||
// const $button = $(event.relatedTarget);
|
||||
// const videoUrl = $button.data('video-url');
|
||||
// const videoTitle = $button.data('video-title');
|
||||
// const videoAllow = $button.data('video-allow');
|
||||
|
||||
// const separator = videoUrl.includes('?') ? '&' : '?';
|
||||
// const autoplayUrl = videoUrl + separator + 'autoplay=1';
|
||||
|
||||
// $modalIframe.attr('src', autoplayUrl);
|
||||
// $modalIframe.attr('title', videoTitle);
|
||||
// $modalIframe.attr('allow', videoAllow);
|
||||
// $modalTitle.text(videoTitle);
|
||||
// });
|
||||
|
||||
// // Cuando se cierra el modal, parar el vídeo
|
||||
// $videoModal.on('hide.bs.modal', function () {
|
||||
// $modalIframe.attr('src', '');
|
||||
// });
|
||||
// });
|
||||
|
||||
// });
|
||||
|
||||
console.log('hello')
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const videoModal = document.getElementById('videoModal');
|
||||
const modalIframe = document.getElementById('modalVideoIframe');
|
||||
const modalTitle = document.getElementById('videoModalLabel');
|
||||
|
||||
// Cuando se abre el modal
|
||||
videoModal.addEventListener('show.bs.modal', function (event) {
|
||||
const button = event.relatedTarget;
|
||||
const videoUrl = button.getAttribute('data-video-url');
|
||||
const videoTitle = button.getAttribute('data-video-title');
|
||||
const videoAllow = button.getAttribute('data-video-allow');
|
||||
|
||||
// Añadir autoplay al URL si no lo tiene
|
||||
const separator = videoUrl.includes('?') ? '&' : '?';
|
||||
const autoplayUrl = videoUrl + separator + 'autoplay=1';
|
||||
|
||||
modalIframe.src = autoplayUrl;
|
||||
modalIframe.title = videoTitle;
|
||||
modalIframe.allow = videoAllow;
|
||||
modalTitle.textContent = videoTitle;
|
||||
});
|
||||
|
||||
// Cuando se cierra el modal, parar el vídeo
|
||||
videoModal.addEventListener('hide.bs.modal', function () {
|
||||
modalIframe.src = '';
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user