Fixed sticky header when scrolling
How do I make an fixed sticky header when scrolling?
Blog post about this on http://hipsterux.com/fixed-header-after-scroll/. What is a fixed sticky header when scrolling? How do you make a fixed sticky header when scrolling? This script and codes were developed by Juan Gallardo on 18 August 2022, Thursday.
Fixed sticky header when scrolling - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Fixed sticky header when scrolling</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <header> <div class="header-banner"> <a href="/" class="logo"></a> <h1>Visit Finland</h1> </div> <div class="clear"></div> <nav> <ul> <li><a href="/archive">Archive</a></li> <li><a href="/events">Events</a></li> <li><a href="/contact">Contact</a></li> <ul> </nav>
</header>
<section class="content"> <article> <p>Wolf vinyl hella, jean shorts disrupt skateboard master cleanse hashtag iPhone. Pop-up bicycle rights Brooklyn iPhone Helvetica kitsch Godard, XOXO blog aesthetic beard quinoa. Fixie kale chips PBR&B twee, YOLO raw denim before they sold out photo booth bespoke seitan food truck. Ethical chia before they sold out, trust fund viral ennui you probably haven't heard of them cred bitters mixtape semiotics deep v jean shorts pork belly occupy shabby chic sriracha ethnic normcore bicycle rights single-origin coffee slow-carb jean shorts. Twee ethnic mumblecore, Carles banh mi slow-carb pour-over organic. Ethical tofu narwhal, hoodie viral ennui tousled paleo. Butcher chia cray iPhone keytar, sustainable Cosby sweater literally try-hard put a bird on it photo booth ethical street art literally semiotics.</p> <img src="http://placehold.it/660x150"> <p>Twee 8-bit Blue Bottle, wolf tattooed distillery retro dreamcatcher put a bird on it letterpress asymmetrical actually Austin crucifix cred. Selfies ethical butcher vegan, umami bitters literally wolf seitan +1 Intelligentsia Pitchfork. Godard mixtape pork belly Pitchfork, fap food truck wolf banh mi post-ironic. Narwhal letterpress Etsy direct trade irony pour-over. Cosby sweater literally Vice DIY butcher selvage shabby chic, XOXO hashtag letterpress single-origin coffee. Artisan Portland disrupt swag small batch chambray, Neutra bespoke Wes Anderson tofu VHS ennui. Cosby sweater letterpress 90's shabby chic cornhole, literally YOLO sartorial bitters Blue Bottle cardigan chambray asymmetrical.</p> <p>Fixie gluten-free sriracha flannel, selfies chambray direct trade. Authentic mixtape semiotics deep v jean shorts pork belly occupy shabby chic sriracha. Tousled Williamsburg fanny pack High Life shabby chic Cosby sweater, gastropub organic cornhole post-ironic hella drinking vinegar cliche wolf pork belly. Wolf selvage cornhole church-key, ethnic raw denim chillwave authentic asymmetrical Austin synth. Single-origin coffee iPhone Carles, Godard synth chia photo booth fap mustache authentic pickled direct trade. Literally Vice Echo Park, trust fund viral ennui you probably haven't heard of them cred biodiesel lomo scenester gastropub chia keffiyeh Intelligentsia. Blue Bottle blog asymmetrical, pickled XOXO sustainable twee seitan cornhole 90's.</p> <p>Flexitarian bitters cardigan tofu tattooed, Kickstarter Thundercats umami hella raw denim mumblecore stumptown Godard trust fund. Pop-up organic iPhone, Godard actually vegan fanny pack Intelligentsia sartorial. Chambray Echo Park you probably haven't heard of them, food truck Wes Anderson Brooklyn brunch. Scenester Austin street art, sartorial sriracha letterpress hashtag. Wayfarers vinyl single-origin coffee, fashion axe pork belly hoodie polaroid mumblecore street art Truffaut. Readymade ethical Carles American Apparel fanny pack twee. Normcore Etsy squid, farm-to-table XOXO forage selfies distillery photo booth Tonx.</p> <p>Mlkshk flexitarian ethical, narwhal forage bespoke artisan hella plaid vinyl try-hard Tonx actually keytar. McSweeney's chambray forage next level, mixtape Austin Portland Odd Future ethical seitan. Gluten-free roof party locavore, pop-up cornhole chambray mlkshk bitters McSweeney's Kickstarter bespoke. YOLO cred pop-up chambray PBR&B. Kitsch mixtape DIY skateboard leggings, YOLO ennui chillwave dreamcatcher put a bird on it. Pug artisan PBR&B PBR dreamcatcher, Marfa Etsy mixtape mustache messenger bag Vice. Plaid lomo pour-over post-ironic, synth disrupt beard Truffaut church-key Tumblr narwhal Bushwick cred slow-carb tofu.</p> <p>Pitchfork disrupt Vice fixie sriracha Blue Bottle. Carles gastropub skateboard Schlitz, Truffaut semiotics PBR fanny pack. Truffaut biodiesel aesthetic, skateboard Etsy distillery blog. Craft beer mumblecore bitters, Tonx fixie viral fingerstache Bushwick occupy. DIY tofu pug lo-fi, street art flexitarian Truffaut. 90's banjo lo-fi master cleanse selvage Tonx, narwhal tote bag. Helvetica before they sold out put a bird on it slow-carb normcore lo-fi.</p> </article> <aside> <img src="http://placehold.it/144x150"> <img src="http://placehold.it/144x150"> </aside>
</section> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Fixed sticky header when scrolling - Script Codes CSS Codes
header { height:360px; z-index:10;
}
.header-banner { background-color: #333; background-image: url('http://37.media.tumblr.com/8b4969985e84b2aa1ac8d3449475f1af/tumblr_n3iftvUesn1snvqtdo1_1280.jpg'); background-position: center; background-repeat: no-repeat; background-size: cover; width: 100%; height: 300px;
}
header .logo { background-color: transparent; background-image: url('http://www.futhead.com/static//img/14/clubs/1887.png'); background-position: center top; background-repeat: no-repeat; position: absolute; top: 72px; height: 256px; width: 256px;
}
header h1 { position: absolute; top: 72px; left: 240px; color: #fff;
}
.fixed-header { position: fixed; top:0; left:0; width: 100%;
}
nav { width:100%; height:60px; background: #292f36; postion:fixed; z-index:10;
}
nav ul { list-style-type: none; margin: 0 auto; padding-left:0; text-align:right; width: 960px; max-width: 100%;
}
nav ul li { display: inline-block; line-height: 60px; margin-left: 10px;
}
nav ul li a { text-decoration: none; color: #a9abae;
}
/* demo */
.content{ width: 960px; max-width: 100%; margin:0 auto; padding-top: 60px; }
article { width: 720px; float: left; }
article p:first-of-type { margin-top: 0; }
aside { width: 120px; float: right; }
aside img { max-width: 100%; }
body { color: #292f36; font-family: helvetica; line-height: 1.6;
}
/* resets */
body { margin:0px; padding:0px; }
Fixed sticky header when scrolling - Script Codes JS Codes
$(window).scroll(function(){ if ($(window).scrollTop() >= 300) { $('nav').addClass('fixed-header'); } else { $('nav').removeClass('fixed-header'); }
});
/* scrollTop() >= 240 Should be equal the the height of the header */
Developer | Juan Gallardo |
Username | JGallardo |
Uploaded | August 18, 2022 |
Rating | 4.5 |
Size | 4,132 Kb |
Views | 40,480 |
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 |
Blog Concept 4 | 4,172 Kb |
Button - Test | 2,834 Kb |
BruxZir - Header with headroom | 5,276 Kb |
International Sort | 2,564 Kb |
Bruxzir - Sprite Practice | 2,723 Kb |
BruxZir - Home Page -3 | 2,170 Kb |
Blog Concept 2 | 2,994 Kb |
Template - iPad Air - Vertical | 1,859 Kb |
BruxZir - Homepage - Video concept | 3,039 Kb |
Foundation - Sample Header | 1,825 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 |
Confirm Close Of Foundation Reveal Modal | Winghouchan | 1,818 Kb |
Vertical Pan Hammer.js example | Jtangelder | 2,144 Kb |
Wikipedia API | Coderpilot | 2,802 Kb |
Hamburger Menu Animation | Salmanraza | 2,580 Kb |
Highbrow Basic HTML Lesson 8 | Kimlarocca | 2,094 Kb |
TheCalendar.js | The-teacher | 6,330 Kb |
Arrow Navigation | Hinducows | 1,973 Kb |
Svg sky | Omodev | 7,070 Kb |
A Pen by Jonas Bjork | Jonasbjork | 3,115 Kb |
Sass random color animation | Jotavejv | 4,827 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!