Sticky Header using Jquery
How do I make an sticky header using jquery?
A simple sticky header using .addClass and .removeClass. Easy to use.. What is a sticky header using jquery? How do you make a sticky header using jquery? This script and codes were developed by Hélio Marcondes on 09 November 2022, Wednesday.
Sticky Header using Jquery - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Sticky Header using Jquery</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <header> <ul> <li>Home</li> <li>Works</li> <li>Blog</li> <li>Join Us</li> <li>About</li>
</header> <div class="text"> SCROLL IT ^ </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 Header using Jquery - Script Codes CSS Codes
*{ margin:0; padding:0; list-style:none;
}
body{ height:1000px;
}
header{ position:fixed; width: 100%; text-align: center; font-size: 40px; line-height: 108px; height: 108px; background: #335C7D; color: #fff; font-family: 'PT Sans', sans-serif; transition: all 0.4s ease;
}
header.sticky { text-align: center; font-size: 24px; line-height: 48px; height: 48px; background: #efc47D; padding-left: 20px;
}
ul{ display:inline-block;
}
li{ display:inline-block; padding:0 40px;
}
.text{ text-align:center; font-size:40px; position:absolute; top:140px; left:600px;
}
Sticky Header using Jquery - Script Codes JS Codes
$(window).scroll(function() {
if ($(this).scrollTop() > 1){ $('header').addClass("sticky"); } else{ $('header').removeClass("sticky"); }
});
Developer | Hélio Marcondes |
Username | haykou |
Uploaded | November 09, 2022 |
Rating | 3 |
Size | 2,024 Kb |
Views | 14,168 |
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!
Name | Size |
Multi step form | 5,689 Kb |
Speedometer, Velocimeter | 2,256 Kb |
Bootstrap Menu with Effect | 2,121 Kb |
Simple Jquery Slider | 2,430 Kb |
Pure AngularJS Tabs | 2,067 Kb |
Simple search using AngularJS | 1,802 Kb |
Custom scrollbar crossbrowser | 5,348 Kb |
Upload image with preview | 2,014 Kb |
Simple way for icons inside input | 1,847 Kb |
Flip CSS Animation with Logo | 1,797 Kb |
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!
Name | Username | Size |
Portfolio Page | KaylaMT | 1,983 Kb |
Android Play Store With Slick Carousel | -J0hn- | 4,982 Kb |
Responsive Table-less Shopping Cart | Alex_rodrigues | 6,637 Kb |
Falling Down the Rabbit Hole | Rachelnabors | 4,578 Kb |
A Pen by Jonas Bjork | Jonasbjork | 3,115 Kb |
Fixed Scrolling Nav Bar | Philsinatra | 0 Kb |
Simple Weather App | Cmwebby | 0 Kb |
3D-box | Parthviroja | 2,346 Kb |
Blog demo to use given styling | Andygirl | 2,412 Kb |
A Pen by Jason Kinney | Jason-kinney | 1,980 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!