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 |
Simple search using AngularJS | 1,802 Kb |
Side Menu using AngularJS | 1,988 Kb |
Simple Form with Icons | 2,071 Kb |
Simple Jquery Slider | 2,430 Kb |
Text on fire | 1,941 Kb |
Pure AngularJS Tabs | 2,067 Kb |
Simple clock with AngularJS | 1,867 Kb |
Sticky Header using Jquery | 2,024 Kb |
Skill Bar with Jquery | 2,470 Kb |
Upload image with preview | 2,014 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 |
SVG Modified with Query String | Jnowland | 1,663 Kb |
Simple jQuery Slider | Jurbank | 2,874 Kb |
Plotting Points with D3.js | Laurakelly | 31,996 Kb |
Velocity.js custom stagger | Tommiehansen | 4,805 Kb |
A cube | KyleDavidE | 18,627 Kb |
BabyStore | Pablo-Ai | 3,807 Kb |
Drop Cap | Gsaiki | 1,571 Kb |
Pure CSS Dial | Lukewatts | 3,018 Kb |
Wip elementary os navbar | Nickcolley | 2,993 Kb |
Simple Login Form | JoshBlackwood | 4,418 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!