I want to hide my drop down menu, to the right so it comes out when the settings logo is clicked on but for some reason it is not working. If anyone can take a look at my code and see what the problem is it would be a great help.
function Startgame() {
var x = Math.floor(Math.random() * 13) + 1;
document.getElementById('computer').src = 'card' + x + '.gif';
document.getElementById('startButton').disabled = "false";
}
function reset() {
total = 0
document.getElementById('computer').src = 'dieDefault.gif';
document.getElementById('img2').src = 'dieDefault.gif';
document.getElementById('score').innerHTML = "0" + total;
}
function puppies() {
document.getElementById('higher').disabled = "false";
document.getElementById('equal').disabled = "false";
document.getElementById('lower').disabled = "false";
}
/////DROPDOWN MENU/////////////
var menuIsOpen = "false";
window.onload = initialise;
function initialise() {
document.getElementById('togglemenu').onclick = navigate;
}
function navigate() {
var panel = document.getElementById("menu");
if (menuIsOpen) {
panel.style.right = "-40em";
menuIsOpen = "false";
document.getElementById('togglemenu').innerHTML = "Open";
} else {
panel.style.top = "0em";
menuIsOpen = "true";
document.getElementById('togglemenu').innerHTML = "Close";
}
}
<div id="settings">
<ul id="menu">
<b> Colour</b>
<form action="menu">
<li>
<input type="radio" value="blackbackground">Black BG</li>
<li>
<input type="radio" value="graybackground">Gray BG</li>
<li id="togglemenu">
<img src="settings_img.png" width="60" hieght="60">
</li>
</form>
</div>
<div id="bodydiv">
<h1> Card Game</h1>
<img src="back.gif" id="computer">
<div id="comp">Computer</div>
<div id="arrow">
<img src="arrow2.png" width="100" height="100">
</div>
<img src="back.gif" id="player">
<div id="play">Player</div>
<div id="kittens">
<button id="startButton" onclick="Startgame();">Start Game</button>
<div id="buttons_1">
<button id="higher" onload="puppies();">Higher</button>
<button id="equal">Equal</button>
<button id="lower">Lower</button>
</div>
<button id="draw" onclick="Startgame();">Draw your card</button>
<div id="resetscore"> <a href="url">Reset Score </a>
</div>
</div>
<div id="score"></div>
</div>