Toggle menu

Size
2,892 Kb
Views
32,384

How do I make an toggle menu?

What is a toggle menu? How do you make a toggle menu? This script and codes were developed by Susanne Karin Lundblad on 13 September 2022, Tuesday.

Toggle menu Previews

Toggle menu - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Toggle menu</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <nav id="menu"> <h3>Menu</h3> <a href="#">Banana page</a> <a href="#">Aple page</a> <a href="#">Kiwi page</a> <a href="#">Orange page</a>
</nav>
<div class="contnent"> <h1>Toggle that menu!</h1> <button class="toggle-btn">Toggle menu</button>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Toggle menu - Script Codes CSS Codes

body { position: relative; left: 0;
}
body.hasMenu { left: -240px;
}
h1,
h3,
a,
p,
*:before { font-family: "Helvetica Neue", sans-serif; font-weight: 300;
}
h1 { color: #3498db;
}
button { position: absolute; right: 0; top: 0; border: 0; background-color: #3498db; color: #fff; border-radius: 4px; padding: 5px 10px; transition: background-color 0.2s ease-out; cursor: pointer; box-shadow: 0 2px 0 #217bb8;
}
button:hover { background-color: #2980b9; box-shadow: 0px 2px 0 #1a6293;
}
button:active,
button:hover,
button:focus { outline: none;
}
button:active { transform: translateY(1px); box-shadow: 0 1px 0 #1a6293;
}
#menu { background: #47a3da; position: fixed; width: 240px; height: 100%; top: 0; z-index: 1000; right: -240px;
}
.hasMenu #menu { right: 0;
}
#menu a { display: block; color: #fff; font-size: 1.1em; font-weight: 300; text-decoration: none; line-height: 1.5; border-bottom: 1px solid #258ecd; padding: 1em;
}
#menu h3 { color: #afdefa; font-size: 1.9em; padding: 20px; margin: 0; font-weight: 300; background: #0d77b6; margin-bottom: 1rem;
}
body,
#menu { -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; transition: all 0.3s ease;
}

Toggle menu - Script Codes JS Codes

$(".toggle-btn").on("click", function() { $("body").toggleClass("hasMenu");
});
Toggle menu - Script Codes
Toggle menu - Script Codes
Home Page Home
Developer Susanne Karin Lundblad
Username SusanneLundblad
Uploaded September 13, 2022
Rating 3
Size 2,892 Kb
Views 32,384
Do you need developer help for Toggle menu?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Susanne Karin Lundblad (SusanneLundblad) Script Codes
Create amazing video scripts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!