Simple CSS and jQuery Responsive Navigation

Developer
Size
2,101 Kb
Views
38,456

How do I make an simple css and jquery responsive navigation?

Expanding from the previous Pen, the pure CSS navigation, this uses jQuery to toggle the navigations visibility when viewed on a mobile device.. What is a simple css and jquery responsive navigation? How do you make a simple css and jquery responsive navigation? This script and codes were developed by Html5andblog on 24 August 2022, Wednesday.

Simple CSS and jQuery Responsive Navigation Previews

Simple CSS and jQuery Responsive Navigation - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Simple CSS and jQuery Responsive Navigation</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <nav>
<ul>
<li><a href="#">Menu Link</a></li>
<li><a href="#">Menu Link</a></li>
<li><a href="#">Menu Link</a></li>
<li><a href="#">Menu Link</a></li>
<li><a href="#">Menu Link</a></li>
<li><a href="#">Menu Link</a></li>
<li><a href="#">Menu Link</a></li>
</ul>
</nav> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Simple CSS and jQuery Responsive Navigation - Script Codes CSS Codes

body {
margin: 0;
}
nav {
background-color: #333;
text-align: center;
}
nav ul {
list-style: none;
padding: 0;
margin: 0
}
nav ul li {
display: inline-block;
padding: 5px 0;
margin: 0;
}
nav ul li a {
font-family: arial;
padding: 0 5px;
text-decoration: none;
color: #fff;
}
nav ul li:hover {
background-color: #555;
}
#responsive-nav {
cursor: pointer;
color: #fff;
font-family: arial;
font-weight: bold;
padding: 5px 0;
}

Simple CSS and jQuery Responsive Navigation - Script Codes JS Codes

/*
Created By:
http://www.html5andbeyond.com
*/
$(document).ready(function(){
$('nav').prepend('<div id="responsive-nav" style="display:none">Menu</div>');
$('#responsive-nav').on('click',function(){
$('nav ul').slideToggle()
});
$(window).resize(function(){
if ($(window).innerWidth() < 768) {
$('nav ul li').css('display','block');
$('nav ul').hide()
$('#responsive-nav').show()
} else {
$('nav ul li').css('display','inline-block');
$('nav ul').show()
$('#responsive-nav').hide()
}
});
$(window).resize();
});
Simple CSS and jQuery Responsive Navigation - Script Codes
Simple CSS and jQuery Responsive Navigation - Script Codes
Home Page Home
Developer Html5andblog
Username html5andblog
Uploaded August 24, 2022
Rating 3
Size 2,101 Kb
Views 38,456
Do you need developer help for Simple CSS and jQuery Responsive Navigation?

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!

Html5andblog (html5andblog) Script Codes
Create amazing art & images 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!