Sticky Navigation or Section with jQuery

Developer
Size
2,297 Kb
Views
78,936

How do I make an sticky navigation or section with jquery?

Script to have a sticky navigation or section with JQuery. What is a sticky navigation or section with jquery? How do you make a sticky navigation or section with jquery? This script and codes were developed by Mia Sno on 12 August 2022, Friday.

Sticky Navigation or Section with jQuery Previews

Sticky Navigation or Section with jQuery - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Sticky Navigation or Section with jQuery</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container">
<div class="section_top"> hello </div>
<div class="stickycontainer">
<div class="notsticky"></div>
<div class="stickynav">
<a href="#whatitdoes" class="whatitdoes">What it Does</a>
<a href="#whyitworks" class="whyitworks">Why it Works</a>
<a href="#compare" class="compare">Other</a>
<a href="#relief" class="relief">Long Lasting Relief</a>
</div>
</div> <div class="text"> <p>content content content</p> <p>content content content</p> <p>content content content</p> <p>content content content</p> <p>content content content</p><p>content content content</p><p>content content content</p><p>content content content</p><p>content content content</p><p>content content content</p><p>content content content</p><p>content content content</p><p>content content content</p><p>content content content</p><p>content content content</p> </div>
</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>

Sticky Navigation or Section with jQuery - Script Codes CSS Codes

.section_top { width: 525px; height: 60px; display: block;
}
.stickycontainer { position:relative;
}
.stickynav {	width: 525px;	background: #6AC9B9;	height: 42px;	line-height: 42px;	box-shadow: 0 3px 8px -2px rgba(0, 0, 0, 0.3);	-webkit-box-shadow: 0 3px 8px -2px rgba(0, 0, 0, 0.3);	vertical-align:middle;	z-index: 500;	position:absolute;	top: 0;
}
.sticktotop {	position:fixed;	top: 0;
}
.notsticky {	height: 42px;
}
.stickynav a {	font-size: 17px;	color: #fff;	margin: 0 8px;	font-weight: 400;
}
.container {	width: 525px;	background: gray;	box-shadow:	0 0 12px 4px rgba(0,0,0,.3),	0 0 120px 80px rgba(255,255,255,.3);	margin: 0 auto; min-height: 800px;
}

Sticky Navigation or Section with jQuery - Script Codes JS Codes

 // Sticky Nav $(function () { // Check the initial Position of the Sticky Header var nav = $('.stickynav'); if (nav.length) { var stickyNavTop = nav.offset().top; $(window).scroll(function () { if ($(window).scrollTop() > stickyNavTop) { $('.stickynav').addClass('sticktotop'); } else { $('.stickynav').removeClass('sticktotop'); } }); } });
Sticky Navigation or Section with jQuery - Script Codes
Sticky Navigation or Section with jQuery - Script Codes
Home Page Home
Developer Mia Sno
Username mrs_snow
Uploaded August 12, 2022
Rating 3
Size 2,297 Kb
Views 78,936
Do you need developer help for Sticky Navigation or Section with jQuery?

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!

Mia Sno (mrs_snow) Script Codes
Create amazing blog posts 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!