我使用PhotosphereViewer显示全景图像。
我使用以下代码成功初始化查看器-
var viewer = new PhotoSphereViewer.Viewer({
panorama: '/images/myimage.jpg',
container: 'stage',
loadingImg: 'https://photo-sphere-viewer.js.org/assets/photosphere-logo.gif',
caption: 'Parc national du Mercantour <b>© Damien Sorel</b>',
defaultLat: 0.3,
plugins: [
[PhotoSphereViewer.MarkersPlugin, {
// list of markers
markers: [
]
}]
]
});
初始化查看器后,我使用以下命令获取对MarkersPlugin的参考-
var markersPlugin = viewer.getPlugin(PhotoSphereViewer.MarkersPlugin);
知道为什么markersPlugin总是null吗???
您需要在html中添加markers.js
文件
喜欢
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/markers.js"></script>
可能需要向标记添加一些内容,如示例https://photo-sphere-viewer.js.org/plugins/plugin-markers.html#usage所示