我正在尝试将kennydude的JavaScript Photo Sphere查看器(https://github.com/kennydude/photosphere)嵌入到基于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>
我将该代码粘贴到.tpl文件中,该文件已上传到我的模板文件夹,我将其通过{{file:code.tpl}
嵌入到“自定义HTML”内容元素中。
但是,它不起作用 - 链接在前端页面中可见,但它不会使Photo Sphere加载 - 但是,它只是将我重定向到球体的JPG文件。
如何在我的Contao前端页面中正确嵌入球体?
提前致谢!