更新时间:2023-12-05 13:56:04
将嵌入的视频放在不可见的div中:
Place the embedded video in a div that is invisible:
<div id="video" style="display: none;"> embedded video code here </div>
然后也给img
一个ID:
<img id="videopic" src="videopic.jpg" alt="Video Picture" />
然后,将图像周围的链接指向一些JavaScript,该JavaScript隐藏该图像并显示嵌入式视频:
Then, put a link round the image pointing to some JavaScript which hides the image and shows the embedded video:
<a href="javascript:document.getElementById('video').style.display = 'block'; document.getElementById('videopic').style.display = 'none'; void(0);">
<img id="videopic" src="videopic.jpg" alt="Video Picture" />
</a>
因此,完整的代码应为:
So, the full code would be:
<div id="video" style="display: none;"> embedded video code here </div>
<a href="javascript:document.getElementById('video').style.display = 'block'; document.getElementById('videopic').style.display = 'none'; void(0);">
<img id="videopic" src="videopic.jpg" alt="Video Picture" />
</a>