jQuery全景查看器插件不起作用

时间:2014-05-21 10:13:33

标签: javascript jquery css

我使用jQuery panaroma viewer插件。但不行动。

HTML:

<div class="panorama">
    <img src="http://www.thepetedesign.com/demos/panorama_viewer/demo_photo.jpg">
</div>

JS:

$(".panorama").panorama_viewer({
    repeat: false, 
    direction: "horizontal", 
    animationTime: 700, 
    easing: "ease-out",
    overlay: true 
});

我该如何解决这个问题?

DEMO JSFIDDLE

1 个答案:

答案 0 :(得分:0)

在“Frameworks&amp; Extensions”下,将onLoad更改为onDomready。 :)工作正常。

您需要打包初始化代码,如下所示:

$(document).ready(function () {
  $(".panorama").panorama_viewer({
    repeat: false, 
    direction: "horizontal", 
    animationTime: 700, 
    easing: "ease-out",
    overlay: true 
  });
});

HTML文件:

...
<script type="text/javascript" src="link-to-jquery.js"></script>
<script type="text/javascript" src="link-to-panorama.js"></script>
<script type="text/javascript">

$(document).ready(function () {
  $(".panorama").panorama_viewer({
    repeat: false, 
    direction: "horizontal", 
    animationTime: 700, 
    easing: "ease-out",
    overlay: true 
  });
});

</script>
</head>

<body>
    <div class="panorama">
        <img src="http://www.thepetedesign.com/demos/panorama_viewer/demo_photo.jpg">
    </div>
...