"Image parallax Effect"
Bootstrap 4.1.1 Snippet by ALIMUL AL RAZY

<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 ----------> <!--- COMPONENT --> <div class="section"> <img class="img-move img-size" data-speed="4" data-type="background"> </div> <!--- SOCIALS --> <div class="socials"> <a class="website" href="https://julienfovelle.fr/" target="_blank"> <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;"> <path d="M1.9,24.3l5.2-3c0.8,1.5,1.7,2.3,3.7,2.3c2.6,0,3.4-1.5,3.4-3.1V2.6h6v17.9c0,5.8-4.1,9-9.5,9C6.7,29.4,3.6,27.7,1.9,24.3z" /> <path d="M22.9,25.8c0-2,1.6-3.6,3.6-3.6s3.6,1.6,3.6,3.6c0,2-1.6,3.6-3.6,3.6S22.9,27.8,22.9,25.8z"/> </svg></a> <a class="dribbble" href="https://dribbble.com/JulienFovelle" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" fill="black" d="M16 0C7.16703 0 0 7.16703 0 16C0 24.833 7.16703 32 16 32C24.8156 32 32 24.833 32 16C32 7.16703 24.8156 0 16 0ZM26.5683 7.37527C28.4772 9.70065 29.6226 12.6681 29.6573 15.8785C29.2061 15.7918 24.6941 14.872 20.1475 15.4447C20.0434 15.2191 19.9566 14.9761 19.8525 14.7332C19.5748 14.0738 19.2625 13.397 18.9501 12.7549C23.9826 10.7072 26.2733 7.75705 26.5683 7.37527ZM16 2.36009C19.4707 2.36009 22.6464 3.66161 25.0586 5.7961C24.8156 6.14317 22.7505 8.90239 17.8915 10.7245C15.6529 6.61171 13.1714 3.24512 12.7896 2.72451C13.8134 2.48156 14.8894 2.36009 16 2.36009ZM10.1866 3.64425C10.551 4.13015 12.9805 7.5141 15.2538 11.5401C8.86768 13.2408 3.22777 13.2061 2.62039 13.2061C3.50542 8.9718 6.36876 5.44902 10.1866 3.64425ZM2.32538 16.0174C2.32538 15.8785 2.32538 15.7397 2.32538 15.6009C2.9154 15.6182 9.54447 15.705 16.3644 13.6573C16.7636 14.4208 17.128 15.2017 17.4751 15.9826C17.3015 16.0347 17.1106 16.0868 16.9371 16.1388C9.89154 18.4121 6.14317 24.6247 5.8308 25.1453C3.6616 22.7332 2.32538 19.5228 2.32538 16.0174ZM16 29.6746C12.8416 29.6746 9.92625 28.5987 7.61822 26.7939C7.86117 26.2907 10.6377 20.9458 18.3427 18.256C18.3774 18.2386 18.3948 18.2386 18.4295 18.2213C20.3557 23.2017 21.1367 27.3839 21.3449 28.5813C19.6963 29.2928 17.8915 29.6746 16 29.6746ZM23.6182 27.3319C23.4794 26.4989 22.7505 22.5076 20.9631 17.5965C25.2495 16.9197 28.9978 18.0304 29.4664 18.1866C28.8764 21.987 26.6898 25.2668 23.6182 27.3319Z" fill="#EA4C89"></path></svg></a> <a class="behance" href="https://www.behance.net/julienfovelle" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path d="M22 7h-7v-2h7v2zm1.726 10c-.442 1.297-2.029 3-5.101 3-3.074 0-5.564-1.729-5.564-5.675 0-3.91 2.325-5.92 5.466-5.92 3.082 0 4.964 1.782 5.375 4.426.078.506.109 1.188.095 2.14h-8.027c.13 3.211 3.483 3.312 4.588 2.029h3.168zm-7.686-4h4.965c-.105-1.547-1.136-2.219-2.477-2.219-1.466 0-2.277.768-2.488 2.219zm-9.574 6.988h-6.466v-14.967h6.953c5.476.081 5.58 5.444 2.72 6.906 3.461 1.26 3.577 8.061-3.207 8.061zm-3.466-8.988h3.584c2.508 0 2.906-3-.312-3h-3.272v3zm3.391 3h-3.391v3.016h3.341c3.055 0 2.868-3.016.05-3.016z"/></svg></a> </div>
body { background: #E8EBF3; height: 200vh; font: 400 16px "Poppins", sans-serif; display: flex; flex-direction: column; justify-content: center; align-items: center; } body .socials { position: fixed; display: block; left: 20px; bottom: 20px; z-index: 9999; } body .socials > a { margin-bottom: 7px; display: block; width: 30px; opacity: 0.2; transform: scale(var(--scale, 0.8)); transition: transform 0.3s cubic-bezier(0.38, -0.12, 0.24, 1.91); } body .socials > a:hover { --scale: 1; } :root { --width-img: 800px ; --height-img: 400px; } .section { display: flex; justify-content: align-center; } .img-move { background-image: url("https://www.icademie.com/img/photos/centre-ville-de-lille-24-1920x1080.jpeg"); background-repeat: no-repeat; background-position: center bottom; background-size: 130%; margin: 0 auto 0; transition: all 0.4s ease-out; } .img-size { width: var(--width-img); height: var(--height-img); }
function BgParallax() { var slider = document.querySelectorAll('.img-move'); slider.forEach((image) => { var yPos = window.pageYOffset / image.dataset.speed; yPos = -yPos; if (yPos > '-180') { var coords = '0%' + yPos + 'px'; image.style.backgroundPosition = coords; } }); } window.addEventListener("scroll", function () { BgParallax(); });

Related: See More


Questions / Comments: