Good, I have a carousel
of bootstrap
in which, when I do click
in the images that are replaced by a video server.
This is the code of one of the items:
<div class="item active" id="unboxing" onclick="PonerVideo(this)">
<img src="img/unboxing.png">
</div>
And when I do click
I call this function:
function PonerVideo(ele){
var titulo = ele.id;
var old = ele.firstChild;
var node = document.createElement("div");
var src = document.createElement("iframe");
node.setAttribute("class", "embed-responsive embed-responsive-16by9");
src.setAttribute("class","embed-responsive-item");
src.setAttribute("src","img/"+titulo+".mp4" );
src.setAttribute("onclick", "Pausa(this)");
node.appendChild(src);
ele.replaceChild(node,old);
}
The video works well, but what it does is move the photo below the video, instead of replacing it.
I tried to do remove child
as well, but that left the photo in its place with the video below.
I put a iframe
because otherwise the video does not fit inside the carousel
item and it is not seen. The videos are from the server where the web is hosted, they are not from YouTube or anything like that.
I must be escaping something but I do not know what.