如何从鼠标悬停图片点击开始YouTube视频点击? [英] How to start a youtube video from mouseover image click?
问题描述
我在网站上工作,碰到JavaScript并需要帮助。
I am working on website and came across to JavaScript and need HELP.
我有一个Youtube视频和两张图片。当我们显示站点时显示一个图像,然后在鼠标悬停后显示第二个图像。但是这第二张图片也应该是视频的链接。
一件重要的事情是我想将视频保存在同一页面中(没有弹出窗口)。
图像的大小也很小,但视频应调整大小。
I have a Youtube video and two images. One image is shown when we display the site, then the second image is shown after mouseover. But this second image should also be a link to the video. One major thing is that I WANT TO KEEP THE VIDEO in the same page (no pop-ups). Also the sizes of the images are small, but the video should be resized.
到目前为止,我知道如何做mouseover,但不知道如何使视频在同一页面中工作。
谢谢
So far I know how to do the mouseover, but do not know how to make the video work in the same page. Thanks
我的mouseover代码---
My code of mouseover ---
<img src="1.png" onmouseover="this.src='2.png'" onmouseout="this.src='1.png'"/>
推荐答案
请看这个答案:
开始/播放嵌入式(iframe)youtube-video点击图片
你可以将你的Youtube视频放在一个iFrame中,并做同样的事情,除了点击()像你一样使用mouseover / mouseout。
You can put your Youtube video inside of an iFrame and do the same thing except instead of a click() you'll be using mouseover/mouseout as you are.
这篇关于如何从鼠标悬停图片点击开始YouTube视频点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!