问题
Before I asked a question how to move videos from one div to another. Now, I have another problem. I want to "attach" an image on each video (actually, I would like to have an image in front of each video) and make it moving together with video.
Instead of pasting my code here, I made a working JSBIN DEMO which could clear the things out. Any possibility of doing this? Anyone could help me?
--- EDIT ----
I have videos, which are moved to other <div>
s on mouseclick. Also I want to attach some icons on these videos, so that the images from original <div>
s would move to another <div>
s together on mouse click when video is clicked.
回答1:
Try placing the image and video into a div together and move the div rather than just the video. Maybe something along the lines of
<div style="height:100;width:100;position:relative;">
<source src="movie.mp4" type="video/mp4" style="position:absolute;z-index:1;">
<img src="image.jpg" style="position:absolute;z-index:2;">
</div>
Use the Z-index to hide the video behind the image in the div, then use javascript or jquery to onclick change z-index variable.
来源:https://stackoverflow.com/questions/24509040/javascript-move-image-together-with-video-to-other-divs