Javascript 视频BG

标签 javascript html css video jquery-plugins

我正在尝试使用 videoBG 中的 jQuery 插件让视频填充 100% 宽度和高度的顶部 div。我想要#top-video 来填充#top-content。问题是什么都没有出现。有什么建议么?谢谢!

<!DOCTYPE html>
<html>
<head>
    <title>Dupont Studios</title>
    <link href= 'style.css' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Oxygen:300' rel='stylesheet' type='text/css'>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
    <script type="text/javascript" src="waypoints.js"></script>
    <script type="text/javascript" src="jquery.videoBG.js"></script>

    <script>


        $(function() {
        // Do our DOM lookups beforehand
        var nav_container = $(".nav-container");
        var nav = $("nav");
        nav_container.waypoint({
        handler: function(direction) {
        nav_container.toggleClass('sticky', direction=='down');
        }
        });
        });


        $('#top_video').videoBG({
        mp4:'test.mp4',
        scale:true,
        zIndex:0
        });




    </script>
</head>
<body>

<div id = 'top-container'>
   <div id = 'top-content'>
       <div id = 'top-video'>
           <span>Here is some text</span>
       </div>


       <div id = 'top-text'>
           <div id = 'top-img'>
               <img src='top-img.png' width = "600" height = '115'>
           </div>
           <h1 id = 'top-slogan'>A Video Production Studio</h1>
       </div>
   </div>
    <div class = 'nav-container'>
        <nav>
            <div id = 'header-img'>
                <img src='top-img.png' width = "450" height = '86.25'>
            </div>
            <div id = 'nav-items-container'>
                <ul class = 'nav-items'>
                    <li class = 'nav-item'><a href='#'><b>w</b>hat</a></li>
                    <li class = 'nav-item'><a href='#'><b>h</b>ow</a></li>
                    <li class = 'nav-item'><a href='#'><b>w</b>hy</a></li>
                    <li class = 'nav-item'><a href='#'><b>w</b>here</a></li>
                    <li class = 'nav-item'><a href='#'><b>w</b>ho</a></li>
                </ul>
            </div>
        </nav>
    </div>
</div>

<div id = 'main-container'>
    <div id = 'main-content'>
        <div id = 'main-content1'>
            <section>
           <h2>what we do</h2>
            <p>We have built a boutique full service video producton studio quite literally in the heart of Dupont Circle.
            Yes, our address is 21 Dupont Circle- we're racross from the south end of the dupont metro stop, right near the Krispy Kreme...mmm,good!</p>
            <p>Unlike other video production studios, we have an exclusive focus on subscription based filming that
                allows for organizations to build their brand and convey their ideas on a weekly, bi-weekly, or monthly basis.</p>

            <p>
                The benefits of subscription based video production allows us to more <mark class = 'blue-me'>deeply partner</mark> with our clients
                and align interest for long term <mark class = 'blue-me'>strategic communication goals</mark>.
            </p>
            </section>
        </div>
        <div id = 'main-content2'>
            <section>
            <div id = 'video-text'>
                <p>We have built a boutique full service video producton studio quite literally in the heart of Dupont Circle.
                    Yes, our address is 21 Dupont Circle- we're racross from the south end of the dupont metro stop, right near the Krispy Kreme...mmm,good!
                </p>
            </div>
            <div id = 'video'>
                <iframe src="http://player.vimeo.com/video/69176991?title=0&amp;byline=0&amp;portrait=0" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
            </div>
            </section>
        </div>
        <section>
        <div id = 'picture'>
            <img src='test.jpg' width = "1200" height = '800'>
        </div>
        </section>
    </div>
</div>
</body>
</html>

最佳答案

你不应该使用 #top-video 而不是 #top_video 作为你的选择器吗?

关于Javascript 视频BG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17452621/

相关文章:

javascript - 如何在 Laravel 应用程序上的 axios 中配置 header

javascript - laravel:非 Laravel 页面上的登录表单

html - 在隐藏范围内搜索文本 (Ctrl+F)

php - 首先显示较旧的帖子

html - 使用类名动态添加css/less中的样式

php - 如何从 html5 + css3 创建 pdf 文件?

javascript - 如何从网页和模板中引用 NPM 安装的库?

javascript - 我需要 js 中的一些 lib 来显示 3d 模型

css - 移动设备上背景图像拉伸(stretch)网站的问题

html - Css视频垂直背景