Skip to content

how to simply open .mp4 video from same directory, not from youtube or vimeo? #1213

@uliwest

Description

@uliwest

Hello,
I'm trying to figure out how to simply open a video in a popup, similar to how images open in a popup. This is my code for images, that works great:

Html:

<a class="image-popup-vertical-fit image-link" href="1.jpg" title=""><img src="1.jpg" width="100%"/></a>

JS:

$(document).ready(function() {
$('.image-popup-vertical-fit').magnificPopup({
type: 'image',
closeOnContentClick: true,
mainClass: 'mfp-img-mobile',
image: {
verticalFit: true
}});});

For videos i currently use this code:

<video width="100%" autoplay loop muted>
<source src="1.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>

I would like the video to open in a pop up when i click on it, same as the image does.

There are plenty of examples of how to open a video hosted on youtub or vimeo in a pop up. But I couldn't find a way to simply open a local video file.

I also tried what is posted here #626 but it didn't work for me, or I didn't understand how to use/modify the code for my purpose.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions