我一直想在图像上添加一个叠加播放按钮,所以当我单击它时就可以播放视频。我的问题是,每个类似的问题都需要在源代码中添加一个单独的叠加播放按钮。

但是,如果我无法在服务器中保留单独的映像,那我可以使用javaScript获得相同的结果吗?如果可以的话,有人可以为此提供示例代码。

我不想使用单独的播放图像..so,有什么方法可以做到吗?

最佳答案

这是一个包含JSBin示例(http://jsbin.com/tarexami/1/edit?html,css,output)的CSS小片段:

.play-button {
  position: absolute;
  width: 60px;
  height: 60px;
  background-color: rgba(0,0,0,0.25);
  border-radius: 100%;
  top: 50%;
  left: 50%;
  margin: -30px 0 0 -30px;
  cursor: pointer;
}

.play-button:after {
  content: '';
  display: block;
  position: absolute;
  left: 22px;
  top: 10px;
  border-width: 20px;
  border-style: solid;
  border-color: transparent transparent transparent white;
}

关于javascript - 如何使用javaScript在图像上叠加播放按钮,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25007862/

10-12 00:14
查看更多