如何在多个地方使用 Photo Sphere Viewer 插件?
How to use Photo Sphere Viewer plugin in multiple places?
我正在使用 Photo Sphere 照片插件。我想在多个地方使用脚本。
<div class="container bs-docs-container">
<div class="row">
<div class="col-md-6" role="main">
<section class="bs-docs-section">
<div id="photosphere"></div>
</section>
</div>
<div class="col-md-6" role="main">
<section class="bs-docs-section">
<div id="photosphere1"></div>
</section>
</div>
</div>
var PSV = new PhotoSphereViewer({
panorama: 'img/Bryce-Canyon-National-Park-Mark-Doliner.jpg',
container: 'photosphere',
caption: 'Photo',
loading_img: 'img/photosphere-logo.gif',
navbar: 'autorotate zoom download caption fullscreen',
default_fov: 70,
mousewheel: true,
size: {
height: 500
}
});
var PSV = new PhotoSphereViewer({
panorama: 'img/Bryce-Canyon-National-Park-Mark-Doliner.jpg',
container: 'photosphere1',
caption: 'Photo',
loading_img: 'img/photosphere-logo.gif',
navbar: 'autorotate zoom download caption fullscreen',
default_fov: 70,
mousewheel: true,
size: {
height: 500
}
});
不是在一个脚本中添加 container: 'photosphere', container: 'photosphere1', 我想在多个地方使用。我在下面提到了演示 url.
使 PhotoSphereViewer 分离函数并将 div id 作为参数传递给该函数。使用 div id(容器 id)在任何你想要的地方调用这个函数。
function psvDivFun(idname)
{
var PSV = new PhotoSphereViewer({
panorama: 'img/Bryce-Canyon-National-Park-Mark-Doliner.jpg',
container: idname,
caption: 'Photo',
loading_img: 'img/photosphere-logo.gif',
navbar: 'autorotate zoom download caption fullscreen',
default_fov: 70,
mousewheel: true,
size: {
height: 500
}
});
}
psvDivFun('photosphere');
psvDivFun('photosphere1');
不要忘记将 'idname' 分配给容器。
container: idname,
我正在使用 Photo Sphere 照片插件。我想在多个地方使用脚本。
<div class="container bs-docs-container">
<div class="row">
<div class="col-md-6" role="main">
<section class="bs-docs-section">
<div id="photosphere"></div>
</section>
</div>
<div class="col-md-6" role="main">
<section class="bs-docs-section">
<div id="photosphere1"></div>
</section>
</div>
</div>
var PSV = new PhotoSphereViewer({
panorama: 'img/Bryce-Canyon-National-Park-Mark-Doliner.jpg',
container: 'photosphere',
caption: 'Photo',
loading_img: 'img/photosphere-logo.gif',
navbar: 'autorotate zoom download caption fullscreen',
default_fov: 70,
mousewheel: true,
size: {
height: 500
}
});
var PSV = new PhotoSphereViewer({
panorama: 'img/Bryce-Canyon-National-Park-Mark-Doliner.jpg',
container: 'photosphere1',
caption: 'Photo',
loading_img: 'img/photosphere-logo.gif',
navbar: 'autorotate zoom download caption fullscreen',
default_fov: 70,
mousewheel: true,
size: {
height: 500
}
});
不是在一个脚本中添加 container: 'photosphere', container: 'photosphere1', 我想在多个地方使用。我在下面提到了演示 url.
使 PhotoSphereViewer 分离函数并将 div id 作为参数传递给该函数。使用 div id(容器 id)在任何你想要的地方调用这个函数。
function psvDivFun(idname)
{
var PSV = new PhotoSphereViewer({
panorama: 'img/Bryce-Canyon-National-Park-Mark-Doliner.jpg',
container: idname,
caption: 'Photo',
loading_img: 'img/photosphere-logo.gif',
navbar: 'autorotate zoom download caption fullscreen',
default_fov: 70,
mousewheel: true,
size: {
height: 500
}
});
}
psvDivFun('photosphere');
psvDivFun('photosphere1');
不要忘记将 'idname' 分配给容器。
container: idname,