【问题标题】:Jquery-tubular plugin issueJquery-tubular插件问题
【发布时间】:2015-01-28 19:06:41
【问题描述】:

我正在尝试制作我的第一个视频背景,并找到了这个管状插件。当我按照步骤操作时,似乎在正文中添加代码变得复杂。 我添加了 jquery 链接,由于某种原因,我添加的代码无效。 谁能帮我如何使这个插件工作?

这是我试图遵循的说明: https://code.google.com/p/jquery-tubular/

提前谢谢你!

这是我的代码:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Using Tubular Plugin</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"         type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="js/jquery.tubular.1.0.js"></script>
<style type="text/css">
body,html { margin:0; padding::0; height:100%; width:100%;}
#topSection {
background-color: #D8D8D8;
height:100%;
min-height:100%;
width:100&;
position:relative;

}
</style>
</head>
<body>
 $().ready(function() {
            $('#wrapper').tubular({videoId: 'idOfYourVideo'}); // where idOfYourVideo is the YouTube ID.
    });
<section id="topSection">Top section- I need a youtube video background     here</section>
</body>
</html>

【问题讨论】:

  • 您在浏览器 javascript 控制台(开发者工具)中遇到什么错误
  • 没有错误先生。它只是像 html 中的文本一样显示 javascript。
  • 那是因为你没有 &lt;script&gt;.&lt;/script&gt; 在 javascript 周围告诉浏览器它是脚本而不是文本

标签: html video background youtube tubular


【解决方案1】:

您好,您是否尝试过从头部调用 jQuery。您应该添加如下代码:

<script>
$("document").ready(function() {
  var options = {  videoId: "xp-8HysWkxw", // where idOfYourVideo is the YouTube ID.
                   start: 0, 
                   repeat: true
                };    
$("#page").tubular(options); // Here is the jQuery call
});
</script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多