Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Scale hero section on scroll"
Bootstrap 4.1.1 Snippet by
ranjit1602
4.1.1
Preview
HTML
CSS
JS
View Full Screen
Fork
Fork this
291
 
0 Fav
Post to Facebook
Tweet this
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="hero"> <h1>Get scrollin'</h1> <div class="down"> <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><polyline points="7 13 12 18 17 13"></polyline><polyline points="7 6 12 11 17 6"></polyline></svg> </div> </div> <div class="content">
@import url('https://rsms.me/inter/inter.css'); html, body { background: #000; } body { font-family: 'Inter', sans-serif; letter-spacing: -1px; text-align: center; font-size: 20px; height: 100vh; color: #fff; margin: 0; } .hero { background: url('https://images.unsplash.com/photo-1550353127-b0da3aeaa0ca') no-repeat center center; justify-content: center; background-size: cover; flex-direction: column; border-radius: 10px; align-items: center; position: fixed; display: flex; height: 100vh; width: 100%; } .down { text-align: center; position: absolute; opacity: 0.6; height: 40px; width: 100%; bottom: 0; } .content { box-shadow: 0 0 100px rgba(0,0,0,0.4); justify-content: center; align-items: flex-end; padding-bottom: 40px; position: relative; background: #000; height: 2000px; display: flex; top: 100vh; }
// Built by @traf // https://tr.af $(window).scroll(function() { var scroll = $(window).scrollTop(); $(".hero").css({ transform: 'translate3d(0, +'+(scroll/100)+'%, 0) scale('+(100 - scroll/100)/100+')' }); });
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76