Created
February 9, 2022 00:13
-
-
Save cruzmayra/0ad2939dc4e8d55faab34b6e699a50ae to your computer and use it in GitHub Desktop.
Como agregar media a carrusel de Elementor sin la versión PRO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* el ID del elemento puede cambiar según nuestro tema */ | |
$("#carousel-home").find(".swiper-slide").each(function() { | |
var div = $(this) | |
var anchor = div.find('a') | |
var imagen = anchor.find('img') | |
var poster = imagen.attr('src') | |
var anchorTitle = anchor.attr('data-elementor-lightbox-title') | |
var index = anchorTitle.indexOf('video') | |
var url = anchor.attr('data-elementor-lightbox-description') | |
if(index >= 0) { | |
var media = `<video data-played="false" oncontextmenu="return false;" controls="" poster="${poster}" controlslist="nodownload" preload="metadata" name="video"> | |
<source src="${url}" type="video/mp4"> | |
Su navegador no soporta video HTML5 | |
</video>` | |
div.empty() | |
div.html(media) | |
} else { | |
anchor.attr('href', url) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment