├── README.md ├── assets ├── css │ └── styles.css ├── img │ ├── imgm.jpg │ ├── imgm1.png │ ├── imgm2.png │ ├── imgm3.png │ └── imgm4.png ├── js │ ├── main.js │ └── rellax.min.js └── scss │ └── styles.scss ├── index.html └── preview.png /README.md: -------------------------------------------------------------------------------- 1 | # Parallax Scrolling Website 2 | ## [Watch it on youtube](https://youtu.be/JrU6bsuNU7Y) 3 | ### Parallax Scrolling Website 4 | 5 | - Parallax Scrolling Animation Using HTML CSS JAVASCRIPT 6 | - Includes CSS animations. 7 | - Includes parallax animation. 8 | - Developed first with the Mobile First methodology, then for desktop. 9 | - Compatible with all mobile devices and with a beautiful and pleasant user interface. 10 | 11 | 💙 Join the channel to see more videos like this. [Bedimcode](https://www.youtube.com/@Bedimcode) 12 | 13 | ![preview img](/preview.png) 14 | -------------------------------------------------------------------------------- /assets/css/styles.css: -------------------------------------------------------------------------------- 1 | /*===== GOGGLE FONTS =====*/ 2 | @import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap"); 3 | /*===== VARIABLES SCSS =====*/ 4 | /*===== VARIABLES CSS =====*/ 5 | /*=== Colores ===*/ 6 | :root { 7 | --first-color: #0396A6; 8 | --dark-color: #000; 9 | --white-color: #F2F2F2; 10 | } 11 | 12 | /*=== Fuente y tipografia ===*/ 13 | :root { 14 | --body-font: 'Open Sans', sans-serif; 15 | --biggest-font-size: 3.5rem; 16 | --h2-font-size: 1.25rem; 17 | --normal-font-size: 0.938rem; 18 | } 19 | 20 | @media screen and (min-width: 768px) { 21 | :root { 22 | --biggest-font-size: 7rem; 23 | --h2-font-size: 1.5rem; 24 | --normal-font-size: 1rem; 25 | } 26 | } 27 | 28 | /*=== z index ===*/ 29 | :root { 30 | --z-back: -10; 31 | --z-normal: 1; 32 | --z-tooltip: 10; 33 | --z-fixed: 100; 34 | --z-modal: 1000; 35 | } 36 | 37 | /*===== BASE =====*/ 38 | *, ::before, ::after { 39 | -webkit-box-sizing: border-box; 40 | box-sizing: border-box; 41 | } 42 | 43 | html { 44 | scroll-behavior: smooth; 45 | } 46 | 47 | body { 48 | margin: 0; 49 | font-family: var(--body-font); 50 | } 51 | 52 | h1, h2, h3, p { 53 | margin: 0; 54 | } 55 | 56 | ul { 57 | margin: 0; 58 | padding: 0; 59 | list-style: none; 60 | } 61 | 62 | a { 63 | text-decoration: none; 64 | } 65 | 66 | img { 67 | max-width: 100%; 68 | height: auto; 69 | } 70 | 71 | /*===== LAYOUT =====*/ 72 | .bd-grid { 73 | max-width: 1200px; 74 | margin-left: 1rem; 75 | margin-right: 1rem; 76 | } 77 | 78 | .l-header { 79 | width: 100%; 80 | position: absolute; 81 | top: 0; 82 | left: 0; 83 | background-color: transparent; 84 | z-index: var(--z-modal); 85 | } 86 | 87 | /*===== NAVBAR =====*/ 88 | .nav { 89 | height: 3rem; 90 | display: -webkit-box; 91 | display: -ms-flexbox; 92 | display: flex; 93 | -webkit-box-pack: justify; 94 | -ms-flex-pack: justify; 95 | justify-content: space-between; 96 | -webkit-box-align: center; 97 | -ms-flex-align: center; 98 | align-items: center; 99 | font-weight: bold; 100 | } 101 | 102 | @media screen and (max-width: 768px) { 103 | .nav__menu { 104 | position: fixed; 105 | left: 0%; 106 | top: -100%; 107 | background-color: rgba(0, 0, 0, 0.9); 108 | width: 100%; 109 | height: 40%; 110 | padding: 2rem; 111 | text-align: center; 112 | z-index: var(--z-fixed); 113 | -webkit-transition: .3s; 114 | transition: .3s; 115 | } 116 | } 117 | 118 | .nav__logo { 119 | color: var(--white-color); 120 | } 121 | 122 | .nav__item { 123 | margin-bottom: 2rem; 124 | } 125 | 126 | .nav__link { 127 | color: var(--white-color); 128 | } 129 | 130 | .nav__toggle { 131 | font-size: 1.5rem; 132 | color: var(--white-color); 133 | cursor: pointer; 134 | } 135 | 136 | /*=== Show menu ===*/ 137 | .show { 138 | top: 3rem; 139 | } 140 | 141 | /*===== HOME =====*/ 142 | .home { 143 | height: 100vh; 144 | overflow: hidden; 145 | position: relative; 146 | } 147 | 148 | .home__parallax { 149 | width: 100%; 150 | height: 100%; 151 | position: absolute; 152 | background-repeat: no-repeat; 153 | background-size: cover; 154 | background-position: center; 155 | } 156 | 157 | .home__parallax-img1 { 158 | background-image: url("/assets/img/imgm1.png"); 159 | z-index: var(--z-normal); 160 | } 161 | 162 | .home__parallax-img2 { 163 | background-image: url("/assets/img/imgm2.png"); 164 | z-index: var(--z-tooltip); 165 | } 166 | 167 | .home__parallax-img3 { 168 | background-image: url("/assets/img/imgm3.png"); 169 | z-index: var(--z-fixed); 170 | } 171 | 172 | .home__parallax-img4 { 173 | background-image: url("/assets/img/imgm4.png"); 174 | z-index: var(--z-fixed); 175 | } 176 | 177 | .home__title, .home__subtitle { 178 | position: absolute; 179 | width: 100%; 180 | display: -webkit-box; 181 | display: -ms-flexbox; 182 | display: flex; 183 | -webkit-box-pack: center; 184 | -ms-flex-pack: center; 185 | justify-content: center; 186 | color: var(--white-color); 187 | } 188 | 189 | .home__title { 190 | top: 32%; 191 | font-size: var(--biggest-font-size); 192 | z-index: var(--z-normal); 193 | } 194 | 195 | .home__subtitle { 196 | top: 44%; 197 | font-size: var(--h2-font-size); 198 | font-weight: bold; 199 | z-index: var(--z-tooltip); 200 | } 201 | 202 | .home__scroll { 203 | position: absolute; 204 | bottom: 2.5rem; 205 | width: 100%; 206 | display: -webkit-box; 207 | display: -ms-flexbox; 208 | display: flex; 209 | -webkit-box-pack: center; 210 | -ms-flex-pack: center; 211 | justify-content: center; 212 | font-size: 1.5rem; 213 | z-index: var(--z-modal); 214 | } 215 | 216 | .home__scroll .bx-mouse { 217 | color: var(--white-color); 218 | } 219 | 220 | /*===== SECTION =====*/ 221 | .l-section { 222 | background-color: var(--dark-color); 223 | } 224 | 225 | .section { 226 | height: 100vh; 227 | max-width: 950px; 228 | margin-left: 1rem; 229 | margin-right: 1rem; 230 | padding: 2rem 0; 231 | color: var(--white-color); 232 | display: -webkit-box; 233 | display: -ms-flexbox; 234 | display: flex; 235 | -webkit-box-orient: vertical; 236 | -webkit-box-direction: normal; 237 | -ms-flex-direction: column; 238 | flex-direction: column; 239 | -webkit-box-pack: space-evenly; 240 | -ms-flex-pack: space-evenly; 241 | justify-content: space-evenly; 242 | -webkit-box-align: center; 243 | -ms-flex-align: center; 244 | align-items: center; 245 | } 246 | 247 | .section__data { 248 | margin-bottom: 3rem; 249 | } 250 | 251 | .section__title { 252 | font-size: var(--h2-font-size); 253 | color: var(--first-color); 254 | margin-bottom: 1rem; 255 | } 256 | 257 | .section__img { 258 | width: 285px; 259 | border-radius: .5rem; 260 | } 261 | 262 | /*===== MEDIA QUERIES =====*/ 263 | @media screen and (min-width: 760px) { 264 | .nav { 265 | height: 4rem; 266 | } 267 | .nav__list { 268 | display: -webkit-box; 269 | display: -ms-flexbox; 270 | display: flex; 271 | } 272 | .nav__item { 273 | margin-right: 3rem; 274 | margin-bottom: 0; 275 | } 276 | .nav__toggle { 277 | display: none; 278 | } 279 | .home__title { 280 | top: 27%; 281 | } 282 | .home__subtitle { 283 | top: 50%; 284 | } 285 | .section { 286 | -webkit-box-orient: horizontal; 287 | -webkit-box-direction: normal; 288 | -ms-flex-direction: row; 289 | flex-direction: row; 290 | margin-left: auto; 291 | margin-right: auto; 292 | } 293 | .section__text { 294 | padding-right: 4rem; 295 | } 296 | .section__img { 297 | width: 470px; 298 | } 299 | } 300 | 301 | @media screen and (min-width: 1200px) { 302 | .bd-grid { 303 | margin-left: auto; 304 | margin-right: auto; 305 | } 306 | } 307 | -------------------------------------------------------------------------------- /assets/img/imgm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bedimcode/parallax-scrolling-website/bf91c927a4b4afb1425e7320968a21172ddde07d/assets/img/imgm.jpg -------------------------------------------------------------------------------- /assets/img/imgm1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bedimcode/parallax-scrolling-website/bf91c927a4b4afb1425e7320968a21172ddde07d/assets/img/imgm1.png -------------------------------------------------------------------------------- /assets/img/imgm2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bedimcode/parallax-scrolling-website/bf91c927a4b4afb1425e7320968a21172ddde07d/assets/img/imgm2.png -------------------------------------------------------------------------------- /assets/img/imgm3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bedimcode/parallax-scrolling-website/bf91c927a4b4afb1425e7320968a21172ddde07d/assets/img/imgm3.png -------------------------------------------------------------------------------- /assets/img/imgm4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bedimcode/parallax-scrolling-website/bf91c927a4b4afb1425e7320968a21172ddde07d/assets/img/imgm4.png -------------------------------------------------------------------------------- /assets/js/main.js: -------------------------------------------------------------------------------- 1 | /*====== MENU =====*/ 2 | const showMenu = (toggleId,navId) =>{ 3 | const toggle = document.getElementById(toggleId), 4 | nav = document.getElementById(navId) 5 | 6 | if(toggle && nav){ 7 | toggle.addEventListener('click', ()=>{ 8 | nav.classList.toggle('show') 9 | }) 10 | } 11 | } 12 | showMenu('nav-toggle','nav-menu') 13 | 14 | /*====== RELLAX =====*/ 15 | var rellax = new Rellax('.parallax'); 16 | 17 | 18 | /*====== ANIMATE GSAP ======*/ 19 | /*Navbar*/ 20 | gsap.from('.nav__logo', {opacity:0, duration: 3, delay: .5, y: 30, ease:'expo.out'}); 21 | gsap.from('.nav__toggle', {opacity:0, duration: 3, delay: .7, y: 30, ease:'expo.out'}); 22 | gsap.from('.nav__item', {opacity: 0, duration: 3, delay: .7, y: 35, ease:'expo.out', stagger: .2}) 23 | 24 | /*Text*/ 25 | gsap.from('.home__title', {opacity:0, duration: 3, delay: 1.3, y: 35, ease:'expo.out'}); 26 | gsap.from('.home__subtitle', {opacity:0, duration: 3, delay: 1.1 , y: 35, ease:'expo.out'}); 27 | 28 | /*Scroll*/ 29 | gsap.from('.home__scroll', {opacity:0, duration: 3, delay: 1.5, y: 25, ease:'expo.out'}); 30 | 31 | 32 | /*====== SCROLL REVEAL SECTION ======*/ 33 | const sr = ScrollReveal({ 34 | duration: 2500, 35 | reset: true 36 | }); 37 | 38 | /*Data*/ 39 | sr.reveal('.section__data',{origin: 'left',distance: '70px'}); 40 | 41 | /*Imgs*/ 42 | sr.reveal('.section__img',{origin: 'left',distance: '90px',delay: 200}); 43 | -------------------------------------------------------------------------------- /assets/js/rellax.min.js: -------------------------------------------------------------------------------- 1 | (function(q,g){"function"===typeof define&&define.amd?define([],g):"object"===typeof module&&module.exports?module.exports=g():q.Rellax=g()})("undefined"!==typeof window?window:global,function(){var q=function(g,u){function C(){if(3===a.options.breakpoints.length&&Array.isArray(a.options.breakpoints)){var f=!0,c=!0,b;a.options.breakpoints.forEach(function(a){"number"!==typeof a&&(c=!1);null!==b&&a=f[0]&&n< 5 | f[1]?"sm":n>=f[1]&&n=d[c].max?d[c].max:e),a.options.horizontal&&!a.options.vertical&&(b=b>=d[c].max?d[c].max:b));null!=d[c].maxY&&(e=e>=d[c].maxY?d[c].maxY:e);null!=d[c].maxX&&(b=b>=d[c].maxX?d[c].maxX:b);a.elems[c].style[E]="translate3d("+(a.options.horizontal?b:"0")+"px,"+(a.options.vertical?e:"0")+"px,"+d[c].zindex+"px) "+d[c].transform}a.options.callback(f)}; 14 | a.destroy=function(){for(var f=0;f 2 | 3 | 4 | 5 | 6 | Parallax responsive landing page 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 33 | 34 |
35 | 36 |
37 |
38 |
39 |
40 |
41 | 42 |

Mountain

43 | Mountain explore 44 | 45 |
46 | 47 |
48 |
49 | 50 | 51 |
52 |
53 |
54 |

Scaling mountains

55 |

Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloribus, laboriosam. Esse ipsum culpa laboriosam, totam hic quidem recusandae eos, numquam iusto aliquid expedita est sapiente quaerat inventore voluptatem corporis aliquam.

56 |
57 | 58 | 59 |
60 |
61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bedimcode/parallax-scrolling-website/bf91c927a4b4afb1425e7320968a21172ddde07d/preview.png --------------------------------------------------------------------------------