Medium.com style header effect
How do I make an medium.com style header effect?
Just pen to show a friend how to create medium-like header effect.. What is a medium.com style header effect? How do you make a medium.com style header effect? This script and codes were developed by Chrysto on 16 July 2022, Saturday.
Medium.com style header effect - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Medium.com style header effect</title> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <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="bg"> <div class="bg-normal"></div> <div class="bg-blur"></div>
</div>
<div class="container"> <header> <div class="slogan-holder"></div> <div class="nav-holder"> <ul class="nav"> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Gallery</a></li> <li><a href="#">Contacts</a></li> </ul> </div> </header> <div class="content"></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Medium.com style header effect - Script Codes CSS Codes
body { font-family:Helvetica,sans-serif;
}
.bg { position:fixed; width:100%; height:500px; z-index:-100;
}
.bg > div { position:absolute; top:0; left:0; width:100%; height:100%; background-repeat:no-repeat; background-size:cover; background-position:center center;
}
.bg-normal { z-index:10; background-image:url(http://cloud.bassta.bg/blur/bg.jpg);
}
.bg-blur { z-index:20; background-image:url(http://cloud.bassta.bg/blur/bg-blur.jpg); opacity:0;
}
.container { z-index:2000;
}
.container header { position:relative; width:100%; height:500px;
}
.slogan-holder { position:relative; width:100%; height:440px;
}
.nav-holder { position:relative; width:100%; height:60px;
}
ul.nav { width:640px; height:60px; margin:0 auto; border-top:1px solid #dededc; list-style:none; text-align:center;
}
ul.nav li { display:inline-block; padding-top:16px; padding-right:40px;
}
ul.nav li a { text-decoration:none; color:#fff; font-size:18px;
}
.content { height:2000px; background-color:#fff;
}
.disable-pointer-events { pointer-events:none!important;
}
Medium.com style header effect - Script Codes JS Codes
$(function(){ /* http://bassta.bg/2013/12/medium-com-like-blurred-header-effect/ */ $window = $(window); $body = $("body"); $bgBlur = $(".bg-blur"); var bgBlurHeight = $bgBlur.height(); var scrollFlag = false; var scrollThreshold = 0.25; //used to debounce pointer events var blurWhenReach = 3; //blur factor, 3 means the imahe will be blurred when you scroll 1/3 of the div $window.on("scroll", function(event){ var scrollTop = $window.scrollTop(); if(!scrollFlag){ scrollFlag = true; $body.addClass("disable-pointer-events"); } debouncePointerEvents(); if(scrollTop < bgBlurHeight){ var _alpha = (scrollTop / bgBlurHeight) * blurWhenReach; if(_alpha > 1){ _alpha = 1 } TweenMax.set($bgBlur, {alpha: _alpha }); } }); // Speed up things by disabling pointer events. I use TweenMax delayedCall instead JS native setInterval just for the sake of showing how to use this method. See more at http://www.thecssninja.com/javascript/pointer-events-60fps function debouncePointerEvents(){ TweenMax.killDelayedCallsTo(addPointerEvents); TweenMax.delayedCall(scrollThreshold, addPointerEvents); } function addPointerEvents(){ scrollFlag = false; $body.removeClass("disable-pointer-events"); }
});
Developer | Chrysto |
Username | bassta |
Uploaded | July 16, 2022 |
Rating | 4.5 |
Size | 2,828 Kb |
Views | 60,720 |
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 GSAP Slider | 2,839 Kb |
A Pen by Chrysto | 2,057 Kb |
Footer concept | 2,210 Kb |
Simple one page header concept | 2,530 Kb |
GSAP Parallax | 2,513 Kb |
One page website scrolling effect | 2,764 Kb |
Page Header animation | 2,828 Kb |
Click outside element | 1,993 Kb |
Smooth scroll | 4,915 Kb |
Single page website | 2,688 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 |
Formations | Cantelope | 5,731 Kb |
Image Hover | Johnheiner | 3,409 Kb |
Sticky menu on scroll | Senff | 2,869 Kb |
A Pen by tugce | Ecgutcnkr | 4,197 Kb |
Rotate Demo | Agelber | 3,061 Kb |
Custom checkbox example | Capelo | 3,495 Kb |
Two Element Typeface | Chrisota | 4,942 Kb |
Mostly Fluid | Mccreath | 3,308 Kb |
Exploding Text | Jjmartucci | 4,749 Kb |
Content Changer | Cliffpyles | 4,538 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!