使用compass 参数和 northOffset 参数为全景图添加指南针
效果:
代码:
<!DOCTYPE HTML>
<html lang="ch">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author"content=“KaiSarH,huankai7@163.com”>
<title>Compass</title>
<link rel="stylesheet" href="pannellum.css"/>
<script type="text/javascript" src="pannellum.js"></script>
<style>
#panorama {
width: 1200px;
height: 800px;
}
</style>
</head>
<body>
<div id="panorama"></div>
<script>
pannellum.viewer('panorama', {
"type": "equirectangular",
"panorama": "test/test7.jpg",
// 添加指南针
"compass": true,
// 指定北偏移量
"northOffset": 300
});
</script>
</body>
</html>
总结: