Learn Beginner

How to Add Pop Up Video into a Website Easily

How to Add Pop Up Video into a Website Easily

Excellent content is important but sometimes words on a page aren’t as impactful as imagery. Pop up video elements can do wonders for both giving your website a human voice while also showcasing a more visually engaging element to your website.

Hey Learner, Welcome back . . .

Video remains one of the most popular forms of content marketing around — and it’s certainly one of the most beneficial for a website.

Here are some of the key benefits to adding video to your website: 

– Increased engagement. By the very nature of the video, it invites engagement. Study after study has shown that people are more likely to watch a video about a topic rather than read a blog about the same topic. People simply love visual elements — especially if those elements move and capture a viewer’s attention. 

– Excellent ROI. Video content elements aren’t always a priority for content marketing teams, but organizations that use them swear they’re worth it. Over 83% of businesses report that their investment in video elements are worth it.

– Improved SEO. This goes back to our first point. Videos naturally increase the time people spend on your website. Longer exposure builds trust with your website — and not just for the human viewers engaging with your content. Longer times and lower bounce rates tell Google that your site probably has viable, relevant content to certain queries. Some studies have indicated that websites are 53% more likely to show up on page one results if they have embedded videos.

– Boosted conversions. Studies have shown that putting a video on a landing page can improve conversions by nearly 80%.

Here’s how to create a popup video element utilizing Magnific Popup is a responsive lightbox:

So, We start with the coding of HTML

HTML

The HTML uses just some default bootstrap classes, including the Bootstrap responsive embed classes:

<div class="container">
  <div class="row">
    <div class="col-sm-12">
      <h1 class="text-center display-4 mt-5">
        Solodev Web Design & Content Management Software
      </h1>
      <p class="text-center mt-5">
        <a href="#headerPopup" id="headerVideoLink" target="_blank" class="btn btn-outline-danger popup-modal">See Why Solodev WXP</a>
      </p>
      <div id="headerPopup" class="mfp-hide embed-responsive embed-responsive-21by9">
        <iframe class="embed-responsive-item" width="854" height="480" src="https://www.youtube.com/embed/qN3OueBm9F4?autoplay=1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
      </div>
    </div>
  </div>
</div>

CSS

We only need some CSS to control how the embed and popup overlay interact:

#headerPopup{
  width:75%;
  margin:0 auto;
}

#headerPopup iframe{
  width:100%;
  margin:0 auto;
}

JS

Some simple JavaScript that initializes Magnific Popup on click:

$(document).ready(function() {
  $('#headerVideoLink').magnificPopup({
    type:'inline',
    midClick: true // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
  });         
});

Want to see how it all looks before committing to its use? Check out the JSFiddle below.

Thank you for reading, and let’s connect!

Thank you for reading my blog, feel free to subscribe to my email newsletter, and ask questions and give your valuable suggestions.

Hiren Vaghasiya

Hiren Vaghasiya

Hiren is an avid technical geek and blog lover. Now a high time tech blogger here, along with Freelancer, Web Designer, Digital Marketer & Sales Funnel Specialist.

Add comment

Leave a Reply

Learn Beginner

Don't be shy, get in touch. We love meeting interesting learners and making the world's best developers.