Use fancybox to pop up the div to bring up the video interface, fancyboxdiv

Source: Internet
Author: User

Use fancybox to pop up the div to bring up the video interface, fancyboxdiv

Fancybox can pop up many forms, or even a small video in swf format. However, these swf videos do not have any controls during playback. Only the tail can be seen or closed at the beginning. We can use fancybox to pop up the div box and html5 to quickly write a code that pops up a small video. First, the effect is shown in. Click the picture to play the video. The background is automatically virtualized.

<Link rel = "stylesheet" type = "text/css" href = "css/fancybox.css"/> <script type = "text/javascript" src = "js/jquery-1.11.3.js"> </script> <script type = "text/javascript" src = "js/jquery. fancybox-1.3.1.pack.js & gt; </script & gt; <script type = "text/javascript" src = "js/main. js "> </script>

Then the html section

<A id = "showdiv1" href = "# box1" title = "test">  </a> <! -- Stores the playback icons, such as img and button. --!> <Div style = "display: none"> <! -- Hide div first --!> <Div id = "box1"> <video id = "movie" src = "movie/1. MP4 "controls =" controls "preload =" meta "> </video> </div>

The last part is the js part.

$(document).ready(function(){    $("#showdiv1").fancybox({        padding:0,        hideOnOverlayClick:false,        fitToView:false,        autoSize:true,        closeClick:true,        openEffect:"none",        closeEffect:"none",        "onClosed":function(){window.document.location.reload(true)},        centerOnScroll:true    })});

At last, you can make some changes to achieve the desired effect.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.