Parallax Hero
Parallax Hero
by Dhanck
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet">
<section class="hero">
<span class="title">Clare & Dani</span>
</section>
<section class="content">
<section class="ct_icon_box_section">
<div class="container">
<div class="ct-section_header ct-section_header--type2">
<h2>
RSVP Wedding Website
</h2>
<div class="ct-section_header-description">
Companies are looking to do business with other great companies. WebCorpCo theme has what it takes to show the world you mean business.
</div>
<div class="clearfix">
</div>
<div class="ct-section_header-separator">
</div>
</div>
<div class="row">
<div class="col-md-4 col-sm-6">
<div class="ct-icon_box media" onclick="location.href='#'">
<div class="media-left">
<i class="fa fa-users"></i>
</div>
<div class="media-body">
<h3 class="media-heading">
Marketing
</h3>
<div class="ct-icon_box-content">
Market to the right person, at the right time, at the place.
</div>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="ct-icon_box media" onclick="location.href='#'">
...
CSS
body .hero {
position: fixed;
z-index: 1;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: url("https://d36tnp772eyphs.cloudfront.net/blogs/2/2019/09/jardin-botanico-malaga-1200x857.jpg") center;
background-size: cover;
height: 90vh;
width: 100vw;
}
body .hero:before {
content: '';
height: 100%;
width: 100%;
height: 170vh;
width: 100vw;
background: rgba(44, 123, 183, 0.3);
position: absolute;
}
body .hero .title {
position: relative;
z-index: 1;
font-family: 'Monserrat', sans-serif!important;
text-transform: uppercase;
color: white;
font-size: 3rem;
line-height: 4rem;
text-shadow: 0 2px 2px rgba(0, 0, 0, 0.35);
max-width: 25rem;
margin: 30vh auto 0;
display: flex;
justify-content: center;
align-content: center;
}
body .content {
position: absolute;
z-index: 1000;
top: 80vh;
background: #faf8f8;
width: 100%;
box-shadow: 0 -2px 1px rgba(0, 0, 0, 0.15);
border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.ct_icon_box {
margin-bottom: 50px;
}
.ct_icon_box_section {
margin-bottom: 60px;
}
.ct-section_header {
text-align: center;
padding-top: 80px;
}
.ct-section_header h2 {
font-size: 65px;
font-size: 6.5rem;
color: #291b07;
font-family: 'Roboto Condensed', sans-serif;
font-weight: bold;
margin-bottom: 0;
}
.ct-section_header.ct-section_header--type2 h2 {
font-size: 50px;
font-size: 5rem;
padding-bottom: 17px;
padding-bottom: 1.7rem;
font-family: 'Roboto Condensed', sans-serif;
}
.ct-section_header.ct-section_header--type2 .ct-section_header-description {
font-size: 18px;
font-size: 1.8rem;
color: #2e2e2e;
font-weight: 400;
padding-bottom: 5px;
padding-bottom: 0.5rem;
font-family: 'Roboto Condensed', sans-serif;
text-align: center;
}
.ct-section_header.ct-section_header--type2 .ct-section_header-separator {
background-color: #0BB3E1;
}
.ct-section_header-separator {
background-color: #924399;
height: 2px;
height:...
JavaScript
$(document).ready(function(){
$(window).scroll(function(e){
parallax();
});
function parallax(){
var scrolled = $(window).scrollTop();
$('.hero').css('top',-(scrolled*0.0315)+'rem');
$('.hero > .title').css('top',-(scrolled*-0.005)+'rem');
$('.hero > .title').css('opacity',1-(scrolled*.00175));
};
});