可以在<a> tag? (Lightbox)

时间:2019-05-09 17:11:03

标签: html video

I've set up a website, and the way i did that i can't just iframe a video or use the tag. Is there any way to put some sort of autoplay on an tag? I'm talking like javascript if needed or any other language. i just want to know.

*EDIT: I'm using lightbox

*EDIT2: I'm trying to make it so that when i click on the a tag, the lightbox shows up and the video starts playing. I've already made it so it pops up on the screen, but i'm unable to click the video, and it just closes it again. That's why i want it to autoplay.

<a href="#" data-videoid="OyeBGqIrjwg" data-videosite="youtube" class="button video link-lightbox">
                        WATCH VIDEO <i class="fa fa-play" aria-hidden="true"></i>
                    </a>

1 个答案:

答案 0 :(得分:-2)

我不确定这是否是您想要的,但是您可以像这样用JavaScript对链接进行自动复制。

<a id="videoLink" href="#" data-videoid="OyeBGqIrjwg" data-videosite="youtube" class="button video link-lightbox">
  WATCH VIDEO <i class="fa fa-play" aria-hidden="true"></i>
</a>
/** SCRIPT TO AUTO CLIC ON LOAD IN LINK WITH ID="videoLink" **/
<script>
    window.onload = function() {
        window.location = $('#videoLink').attr('href');
    };
</script>