我正在努力让同位素在我的网站的单个页面上工作,这样我就能以一种奇特的方式分享网络视频。我将Isotope文件上传到我的网站,然后将以下代码放入我在一个页面上发布的文章中。当我查看页面时,我可以看到我想要观看的视频的图像,当我点击它们时我可以观看它们但没有动画或移动,图像是静态的,并且在页面的一侧是垂直线条。
我犯了某种错误或者没有理解某些东西,有人能指出我正确的方向。我正在使用的代码如下:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>· Videos</title>
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="stylesheet" href="/public_html/templates/rt_mediamogul/Iso/style.css" />
<!-- scripts at bottom of page -->
</head>
<body class="demos ">
<section id="content">
<h1>Images</h1>
<section id="copy">
<p>Isotope is triggered after all images are loaded with the <a href="public_html/templates/rt_mediamogul/Iso/help.html#imagesloaded_plugin"> <code>imagesLoaded</code> plugin</a>. </p>
</section>
<div id="container" class="photos clearfix">
<div class="photo">
<a href="http://www.youtube.com/watch?v=u_IHMPVFyq8" title="Tiger Surgery on Youtube"><img src="http://i4.ytimg.com/vi/u_IHMPVFyq8/mqdefault.jpg" alt="Science" /></a>
</div>
<div class="photo">
<a href="http://www.youtube.com/watch?v=vj-H_Mbfvu4" title="Is engineering right for me, on Youtube"><img src="http://i4.ytimg.com/vi/vj-H_Mbfvu4/mqdefault.jpg" alt="Science" /></a>
</div>
<div class="photo">
<a href="http://www.youtube.com/watch?v=I9t-gYnPNaw" title="A fast math trick, on Youtube"><img src="http://i4.ytimg.com/vi/I9t-gYnPNaw/mqdefault.jpg" alt="Science" /></a>
</div>
<div class="photo">
<a href="http://www.youtube.com/watch?v=3-tXkRb2GFY" title="Biology by Khan Academy, on Youtube"><img src="http://i4.ytimg.com/vi/3-tXkRb2GFY/mqdefault.jpg" alt="Science" /></a>
</div>
<div class="photo">
<a href="http://www.youtube.com/watch?v=4FROxZ5i67k" title="Space Shuttle Launch, on Youtube"><img src="http://i4.ytimg.com/vi/4FROxZ5i67k/mqdefault.jpg" alt="Science" /></a>
</div>
<div class="photo">
<a href="http://www.youtube.com/watch?v=6aK2CKrdjbE" title="Mr Bean does Chemistry"><img src="http://i4.ytimg.com/vi/6aK2CKrdjbE/mqdefault.jpg" alt="Science" /></a>
</div>
<div class="photo">
<a href="http://www.youtube.com/watch?v=k6U-i4gXkLM" title="Introduction to computer programing, on Youtube"><img src="http://i4.ytimg.com/vi/k6U-i4gXkLM/mqdefault.jpg" alt="Science" /></a>
</div>
<div class="photo">
<a href="http://www.youtube.com/watch?v=3vgNvXdkQaU" title="Identifying rocks for dinner."><img src="http://i4.ytimg.com/vi/3vgNvXdkQaU/mqdefault.jpg" alt="Science" /></a>
</div>
<div class="photo">
<a href="http://www.youtube.com/watch?v=NHjLO_cw5iE" title="Punk economics in Ireland"><img src="http://i4.ytimg.com/vi/NHjLO_cw5iE/mqdefault.jpg" alt="Science" /></a>
</div>
</div> <!-- #container -->
<script src="public_html/templates/rt_mediamogul/Iso/jquery-1.7.1.min.js"></script>
<script src="public_html/templates/rt_mediamogul/Iso/jquery.isotope.min.js"></script>
<script>
$(function(){
var $container = $('#container');
$container.imagesLoaded( function(){
$container.isotope({
itemSelector : '.photo'
});
});
});
答案 0 :(得分:1)
我很确定你不能将html标签等添加到文章中,因为这基本上将它视为一个全新的页面。因此,以下方法无效:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>· Videos</title>
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="stylesheet" href="/public_html/templates/rt_mediamogul/Iso/style.css" />
<!-- scripts at bottom of page -->
</head>
也不会body
标记,因为页面已经包含此标记,因此您将使该页面包含2个body
标记。您可以创建一个简单的模块,将其嵌入到您的文章中并使用for each脚本,只需将以下代码添加到顶部的php部分:
$document->addScript(JURI::root() . "modules/mod_yourmodule/script.js");
答案 1 :(得分:0)
加载javascripts时在public_html之前添加斜杠:
<script src="/public_html/...">