Hi Kris,
There are probably better ways to do this dynamically, but here's a quick way to do it hardcoded. I also did some tweaking, check my steps below.
What I did:
Added a (simple) nested menu to my index.html file, you can also view this in the source of the website above.
Also note that I have give it the ID "sceneList2". sceneList is the original one used by Marzipano. I pasted the urls from the original SceneList in the menu links.
<nav class="dropdownmenu">
<ul id="sceneList2">
<li><a>Outside the park</a>
<ul id="submenu">
<li><a href="javascript:void(0)" class="scene" data-id="0-r0010044">Scene 1</a></li>
</ul>
</li>
<li><a>Inside the park</a>
<ul id="submenu">
<li><a href="javascript:void(0)" class="scene" data-id="1-r0010047">Scene 2</a></li>
<li><a href="javascript:void(0)" class="scene" data-id="2-r0010048">Scene 3</a></li>
</ul>
</li>
</ul>
</nav>
Second I added the CSS of the menu. I specifically added z-index:1 so that the menu will hover on top.
.dropdownmenu ul, .dropdownmenu li {
margin: 0;
padding: 0;
z-index:1;
}
.dropdownmenu ul {
background: gray;
list-style: none;
width: 100%;
}
.dropdownmenu li {
float: left;
position: relative;
width:auto;
}
.dropdownmenu a {
background: #30A6E6;
color: #FFFFFF;
display: block;
font: bold 12px/20px sans-serif;
padding: 10px 25px;
text-align: center;
text-decoration: none;
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
.dropdownmenu li:hover a {
background: #000000;
}
#submenu {
left: 0;
opacity: 0;
position: absolute;
top: 35px;
visibility: hidden;
z-index: 1;
}
li:hover ul#submenu {
opacity: 1;
top: 40px; /* adjust this as per top nav padding top & bottom comes */
visibility: visible;
}
#submenu li {
float: none;
width: 100%;
}
#submenu a:hover {
background: #DF4B05;
}
#submenu a {
background-color:#000000;
}
Third, in index.html I have hidden the old Scenelist, Titlebar and Autorotate by adding the tag; style="display: none"
You can't just delete the old sceneList because it causes JavaScript errors
Four, in index.js I have added another scenes.forEach clause right under the original one to make the new menu clickable in scenelist2.
scenes.forEach(function(scene) {
var el = document.querySelector('#
sceneList2 .scene[data-id="' +
scene.data.id + '"]');
el.addEventListener('click', function() {
switchScene(scene);
});
});
If you have any questions, let me know,
greetings
Joost
Op donderdag 21 januari 2021 om 13:46:44 UTC+1 schreef Kris: