Javascript 如何在Contao 2中包含照片球体?

Javascript 如何在Contao 2中包含照片球体?,javascript,contao,photosphere,Javascript,Contao,Photosphere,我正在尝试将kennydude的JavaScript Photo Sphere viewer()嵌入到基于Contao CMS 2.11的网站中。我基本上使用了他的test.html中的以下代码,我将其改编为特定站点: <a href="http://www.***.tld/tl_files/labor/scripts/pano1.jpg" id="goForIt">Berechnen</a> <div id="sphere" style="width: 100%;

我正在尝试将kennydude的JavaScript Photo Sphere viewer()嵌入到基于Contao CMS 2.11的网站中。我基本上使用了他的test.html中的以下代码,我将其改编为特定站点:

<a href="http://www.***.tld/tl_files/labor/scripts/pano1.jpg" id="goForIt">Berechnen</a>
<div id="sphere" style="width: 100%; height: 300px;"></div>
<script src="http://www.***.tld/tl_files/labor/scripts/three.min.js"></script>
<script type="text/javascript" src="http://www.***.tld/tl_files/labor/scripts/sphere.js"></script>
<script type="text/javascript">
    document.getElementById("goForIt").onclick = function(){
    sphere = new Photosphere(this.getAttribute("href"));
    sphere.loadPhotosphere(document.getElementById("sphere"));
    return false;
    };
</script>

document.getElementById(“goForIt”).onclick=function(){
球体=新的光球(this.getAttribute(“href”);
loadphosphere(document.getElementById(“球体”);
返回false;
};
我将代码粘贴到一个.tpl文件中,该文件已上载到我的templates文件夹,并通过
{{file:code.tpl}
将其嵌入到一个“自定义HTML”内容元素中

但是,它不起作用-链接在前端页面中可见,但不会加载Photo Sphere-但是,它只是将我重定向到Sphere的JPG文件

如何在Contao前端页面中正确嵌入球体


提前感谢!

此问题与无关。你懂javascript吗?一般来说,我懂……你的意思是脚本中有错误吗?我认为问题可能与我以错误的方式嵌入脚本有关,使Contao的安全系统阻止加载它。我建议你使用Contao 3。你可以n在布局中定义自定义标题脚本。