-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcam2.html
88 lines (84 loc) · 2.58 KB
/
cam2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Balatonkenese virtuális háztúra</title>
<link rel="stylesheet" href="/css/pannellum.css"/>
<script src="/js/pannellum.js"></script>
<link rel="stylesheet" href="/css/cam.css">
</head>
<body>
<div id="panorama">
<div id="minimap">
<div class="cam cam1"></div>
<div class="cam cam2"></div>
<div class="cam cam3"></div>
<div class="cam cam4"></div>
<div class="cam cam5"></div>
<div class="cam cam6"></div>
<div class="cam cam7"></div>
<div class="cam cam8"></div>
</div>
</div>
<script>
function loadJSON(url, callback) {
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open('GET', url, true);
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
callback(xobj.responseText);
}
};
xobj.send(null);
}
loadJSON("scenes.json", function(response) {
// Parse JSON string into object
var myscenes = JSON.parse(response);
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const cam = urlParams.get('cam');
switch(urlParams.get('cam')){
case "1": myscenes.default.firstScene="szoba1"; break;
case "2": myscenes.default.firstScene="furdo"; break;
case "3": myscenes.default.firstScene="konyha"; break;
case "4": myscenes.default.firstScene="folyoso"; break;
case "5": myscenes.default.firstScene="szoba2"; break;
case "6": myscenes.default.firstScene="emelet"; break;
case "7": myscenes.default.firstScene="udvar"; break;
case "8": myscenes.default.firstScene="szoba3"; break;
}
var viewer = pannellum.viewer('panorama', myscenes);
document.querySelectorAll('.cam').forEach(function(item){
item.addEventListener('click', function(event){
if (event.target.classList.contains('cam1')){
viewer.loadScene('szoba1');
}
if (event.target.classList.contains('cam2')){
viewer.loadScene('furdo');
}
if (event.target.classList.contains('cam3')){
viewer.loadScene('konyha');
}
if (event.target.classList.contains('cam4')){
viewer.loadScene('folyoso');
}
if (event.target.classList.contains('cam5')){
viewer.loadScene('szoba2');
}
if (event.target.classList.contains('cam6')){
viewer.loadScene('emelet');
}
if (event.target.classList.contains('cam7')){
viewer.loadScene('udvar');
}
if (event.target.classList.contains('cam8')){
viewer.loadScene('szoba3');
}
});
});
});
</script>
</body>
</html>