├── README.md ├── css ├── component.css ├── demo.css └── normalize.css ├── fonts └── codropsicons │ ├── codropsicons.eot │ ├── codropsicons.svg │ ├── codropsicons.ttf │ ├── codropsicons.woff │ └── license.txt ├── img ├── 1.jpg ├── 2.jpg ├── 3.jpg └── 4.jpg ├── index.html ├── index2.html ├── index3.html └── js ├── boxesFx.js ├── classie.js └── modernizr.custom.js /README.md: -------------------------------------------------------------------------------- 1 | Four Boxes Slideshow 2 | ========= 3 | 4 | A tutorial on how to recreate the four panel background image slideshow seen on Atelier Serge Thoroval's website. 5 | 6 | [Article on Codrops](http://tympanus.net/codrops/?p=19242) 7 | 8 | [Demo](http://tympanus.net/Tutorials/FourBoxes/) 9 | 10 | Integrate or build upon it for free in your personal or commercial projects. Don't republish, redistribute or sell "as-is". 11 | 12 | Images used in demo are made with Mockups made by [Mockuuups.com](http://www.mockuuups.com/) 13 | 14 | Read more here: [License](http://tympanus.net/codrops/licensing/) 15 | 16 | [© Codrops 2014](http://www.codrops.com) 17 | -------------------------------------------------------------------------------- /css/component.css: -------------------------------------------------------------------------------- 1 | html, body, .container { 2 | height: 100%; 3 | } 4 | 5 | .js .boxgallery, 6 | .js .boxgallery div { 7 | position: absolute; 8 | } 9 | 10 | .js .boxgallery, 11 | .bg-tile, 12 | .bg-img { 13 | overflow: hidden; 14 | } 15 | 16 | .js .boxgallery, 17 | .js .panel { 18 | top: 0; 19 | left: 0; 20 | width: 100%; 21 | height: 100%; 22 | } 23 | 24 | .panel { 25 | z-index: 0; 26 | -webkit-perspective: 1200px; 27 | perspective: 1200px; 28 | } 29 | 30 | .bg-tile { 31 | width: 50%; 32 | height: 50%; 33 | } 34 | 35 | .bg-tile:nth-child(2), 36 | .bg-tile:nth-child(4) { 37 | left: 50%; 38 | } 39 | 40 | .bg-tile:nth-child(3), 41 | .bg-tile:nth-child(4) { 42 | top: 50%; 43 | } 44 | 45 | .bg-img { 46 | width: 100%; 47 | height: 100%; 48 | background: #999; 49 | } 50 | 51 | .bg-img img { 52 | position: absolute; 53 | display: block; 54 | height: 200%; 55 | } 56 | 57 | @media screen and (min-aspect-ratio: 1280/850) { 58 | .bg-img img { 59 | width: 200%; 60 | height: auto; 61 | } 62 | } 63 | 64 | .bg-tile:nth-child(2) .bg-img img, 65 | .bg-tile:nth-child(4) .bg-img img { 66 | left: -100%; 67 | } 68 | 69 | .bg-tile:nth-child(3) .bg-img img, 70 | .bg-tile:nth-child(4) .bg-img img { 71 | top: -100%; 72 | } 73 | 74 | /* Navigation Arrow */ 75 | .boxgallery > nav span { 76 | position: absolute; 77 | top: 50%; 78 | z-index: 1000; 79 | display: block; 80 | width: 100px; 81 | height: 100px; 82 | outline: none; 83 | text-align: left; 84 | cursor: pointer; 85 | -webkit-transform: translateY(-50%); 86 | transform: translateY(-50%); 87 | } 88 | 89 | .boxgallery > nav span.prev { 90 | left: 0; 91 | } 92 | 93 | .boxgallery > nav span.next { 94 | right: 0; 95 | } 96 | 97 | .boxgallery > nav i { 98 | position: relative; 99 | display: block; 100 | width: 100%; 101 | height: 100%; 102 | } 103 | 104 | .boxgallery > nav span::before, 105 | .boxgallery > nav span::after, 106 | .boxgallery > nav i::before, 107 | .boxgallery > nav i::after { 108 | position: absolute; 109 | left: 50%; 110 | width: 3px; 111 | height: 50%; 112 | outline: 1px solid transparent; 113 | background: #dbccd0; 114 | content: ''; 115 | -webkit-transition: -webkit-transform 0.3s; 116 | transition: transform 0.3s; 117 | -webkit-backface-visibility: hidden; 118 | backface-visibility: hidden; 119 | } 120 | 121 | .boxgallery > nav i::before, 122 | .boxgallery > nav i::after { 123 | z-index: 100; 124 | height: 0; 125 | background: #fff; 126 | -webkit-transition: height 0.3s, -webkit-transform 0.3s; 127 | transition: height 0.3s, transform 0.3s; 128 | } 129 | 130 | .boxgallery > nav span::before, 131 | .boxgallery > nav i::before { 132 | top: 50%; 133 | -webkit-transform: translateX(-50%) rotate(-135deg); 134 | transform: translateX(-50%) rotate(-135deg); 135 | -webkit-transform-origin: 50% 0%; 136 | transform-origin: 50% 0%; 137 | } 138 | 139 | .boxgallery > nav span.next::before, 140 | .boxgallery > nav span.next i::before { 141 | -webkit-transform: translateX(-50%) rotate(135deg); 142 | transform: translateX(-50%) rotate(135deg); 143 | -webkit-transform-origin: 50% 0%; 144 | transform-origin: 50% 0%; 145 | } 146 | 147 | .boxgallery > nav span::after, 148 | .boxgallery > nav i::after { 149 | top: 50%; 150 | -webkit-transform: translateX(-50%) rotate(-45deg); 151 | transform: translateX(-50%) rotate(-45deg); 152 | -webkit-transform-origin: 0 0; 153 | transform-origin: 0 0; 154 | } 155 | 156 | .boxgallery > nav span.next::after, 157 | .boxgallery > nav span.next i::after { 158 | -webkit-transform: translateX(-50%) rotate(45deg); 159 | transform: translateX(-50%) rotate(45deg); 160 | -webkit-transform-origin: 100% 0%; 161 | transform-origin: 100% 0%; 162 | } 163 | 164 | .no-touch .boxgallery > nav span:hover i::before, 165 | .no-touch .boxgallery > nav span:hover i::after { 166 | height: 50%; 167 | } 168 | 169 | .no-touch .boxgallery > nav span:hover::before, 170 | .no-touch .boxgallery > nav span:hover i::before { 171 | -webkit-transform: translateX(-50%) rotate(-125deg); 172 | transform: translateX(-50%) rotate(-125deg); 173 | } 174 | 175 | .no-touch .boxgallery > nav span.next:hover::before, 176 | .no-touch .boxgallery > nav span.next:hover i::before { 177 | -webkit-transform: translateX(-50%) rotate(125deg); 178 | transform: translateX(-50%) rotate(125deg); 179 | } 180 | 181 | .no-touch .boxgallery > nav span:hover::after, 182 | .no-touch .boxgallery > nav span:hover i::after { 183 | -webkit-transform: translateX(-50%) rotate(-55deg); 184 | transform: translateX(-50%) rotate(-55deg); 185 | } 186 | 187 | .no-touch .boxgallery > nav span.next:hover::after, 188 | .no-touch .boxgallery > nav span.next:hover i::after { 189 | -webkit-transform: translateX(-50%) rotate(55deg); 190 | transform: translateX(-50%) rotate(55deg); 191 | } 192 | 193 | /* Transitions and individual delays/effects */ 194 | /* The "active" class is given to the panel that is coming */ 195 | 196 | .panel.current { 197 | z-index: 2; 198 | } 199 | 200 | .panel.active { 201 | z-index: 1; 202 | } 203 | 204 | .panel.current .bg-img { 205 | -webkit-transition: -webkit-transform 1.1s ease-in-out; 206 | transition: transform 1.1s ease-in-out; 207 | } 208 | 209 | .boxgallery[data-effect="effect-1"] .panel.active .bg-tile, 210 | .boxgallery[data-effect="effect-2"] .panel.active .bg-tile { 211 | -webkit-animation: scaleDown 1.1s ease-in-out; 212 | animation: scaleDown 1.1s ease-in-out; 213 | } 214 | 215 | @-webkit-keyframes scaleDown { 216 | from { -webkit-transform: translate3d(0,0,380px); transform: translate3d(0,0,380px); } 217 | to { -webkit-transform: translate3d(0,0,0); transform: translate3d(0,0,0); } 218 | } 219 | 220 | @keyframes scaleDown { 221 | from { -webkit-transform: translate3d(0,0,380px); transform: translate3d(0,0,380px); } 222 | to { -webkit-transform: translate3d(0,0,0); transform: translate3d(0,0,0); } 223 | } 224 | 225 | /* Variation 2 */ 226 | .boxgallery[data-effect="effect-2"] .panel.current .bg-img { 227 | -webkit-transition: -webkit-transform 0.9s cubic-bezier(0.7,0,0.3,1); 228 | transition: transform 0.9s cubic-bezier(0.7,0,0.3,1); 229 | } 230 | 231 | .boxgallery[data-effect="effect-2"] .panel.current .bg-tile:nth-child(2) .bg-img { 232 | -webkit-transition-delay: 0.15s; 233 | transition-delay: 0.15s; 234 | } 235 | 236 | .boxgallery[data-effect="effect-2"] .panel.current .bg-tile:nth-child(3) .bg-img { 237 | -webkit-transition-delay: 0.3s; 238 | transition-delay: 0.3s; 239 | } 240 | 241 | .boxgallery[data-effect="effect-2"] .panel.current .bg-tile:nth-child(4) .bg-img { 242 | -webkit-transition-delay: 0.45s; 243 | transition-delay: 0.45s; 244 | } 245 | 246 | /* Variation 3 */ 247 | .boxgallery[data-effect="effect-3"] .panel::after { 248 | position: absolute; 249 | width: 100%; 250 | height: 100%; 251 | background: rgba(0,0,0,0.8); 252 | content: ''; 253 | -webkit-transition: opacity 1.1s ease-in-out; 254 | transition: opacity 1.1s ease-in-out; 255 | } 256 | 257 | .boxgallery[data-effect="effect-3"] .panel.current::after, 258 | .boxgallery[data-effect="effect-3"] .panel.active::after { 259 | opacity: 0; 260 | } 261 | 262 | .boxgallery[data-effect="effect-3"] .panel.current::after { 263 | -webkit-transition: none; 264 | transition: none; 265 | } 266 | 267 | .boxgallery[data-effect="effect-3"] .panel.current .bg-img { 268 | -webkit-transition: -webkit-transform 1.1s cubic-bezier(0.7,0,0.3,1); 269 | transition: transform 1.1s cubic-bezier(0.7,0,0.3,1); 270 | } 271 | 272 | .boxgallery[data-effect="effect-3"] .panel.current .bg-tile:nth-child(2) .bg-img { 273 | -webkit-transition-delay: 0.15s; 274 | transition-delay: 0.15s; 275 | } 276 | 277 | .boxgallery[data-effect="effect-3"] .panel.current .bg-tile:nth-child(3) .bg-img { 278 | -webkit-transition-delay: 0.3s; 279 | transition-delay: 0.3s; 280 | } 281 | 282 | .boxgallery[data-effect="effect-3"] .panel.current .bg-tile:nth-child(4) .bg-img { 283 | -webkit-transition-delay: 0.45s; 284 | transition-delay: 0.45s; 285 | } 286 | 287 | @media screen and (max-width: 380px) { 288 | .boxgallery > nav span { 289 | width: 50px; 290 | height: 50px; 291 | } 292 | } -------------------------------------------------------------------------------- /css/demo.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-weight: normal; 3 | font-style: normal; 4 | font-family: 'codropsicons'; 5 | src:url('../fonts/codropsicons/codropsicons.eot'); 6 | src:url('../fonts/codropsicons/codropsicons.eot?#iefix') format('embedded-opentype'), 7 | url('../fonts/codropsicons/codropsicons.woff') format('woff'), 8 | url('../fonts/codropsicons/codropsicons.ttf') format('truetype'), 9 | url('../fonts/codropsicons/codropsicons.svg#codropsicons') format('svg'); 10 | } 11 | 12 | *, *:after, *:before { -webkit-box-sizing: border-box; box-sizing: border-box; } 13 | .clearfix:before, .clearfix:after { content: ''; display: table; } 14 | .clearfix:after { clear: both; } 15 | 16 | body { 17 | background: #333; 18 | color: #fff; 19 | font-weight: 200; 20 | font-size: 1em; 21 | font-family: 'Raleway', 'Arial', sans-serif; 22 | } 23 | 24 | a { 25 | color: #fff; 26 | text-decoration: none; 27 | outline: none; 28 | font-weight: 600; 29 | } 30 | 31 | a:hover, a:focus { 32 | color: #debcc3; 33 | } 34 | 35 | section { 36 | padding: 1em; 37 | text-align: center; 38 | } 39 | 40 | /* Header */ 41 | .codrops-header { 42 | z-index: 1000; 43 | position: absolute; 44 | top: 50%; 45 | left: 50%; 46 | text-align: center; 47 | max-width: 500px; 48 | -webkit-transform: translate(-50%,-50%); 49 | transform: translate(-50%,-50%); 50 | -webkit-backface-visibility: hidden; 51 | backface-visibility: hidden; 52 | } 53 | 54 | .codrops-header h1 { 55 | margin: 0; 56 | font-weight: 200; 57 | font-size: 3em; 58 | line-height: 1; 59 | } 60 | 61 | .codrops-header h1 span { 62 | display: block; 63 | padding: 0.5em 0 0.6em 0.1em; 64 | font-size: 40%; 65 | line-height: 1.2; 66 | opacity: 0.7; 67 | } 68 | 69 | /* To Navigation Style */ 70 | .codrops-top { 71 | width: 100%; 72 | text-transform: uppercase; 73 | font-weight: 400; 74 | font-size: 0.69em; 75 | line-height: 2.2; 76 | position: relative; 77 | z-index: 2000; 78 | } 79 | 80 | .codrops-top a { 81 | display: inline-block; 82 | padding: 0.3em 0.7em; 83 | text-decoration: none; 84 | letter-spacing: 1px; 85 | margin: 5px; 86 | } 87 | 88 | .codrops-top span.right { 89 | float: right; 90 | } 91 | 92 | .codrops-top span.right a { 93 | display: block; 94 | float: left; 95 | } 96 | 97 | .codrops-icon:before { 98 | margin: 0 4px; 99 | text-transform: none; 100 | font-weight: normal; 101 | font-style: normal; 102 | font-variant: normal; 103 | font-family: 'codropsicons'; 104 | line-height: 1; 105 | speak: none; 106 | -webkit-font-smoothing: antialiased; 107 | } 108 | 109 | .codrops-icon-drop:before { 110 | content: "\e001"; 111 | } 112 | 113 | .codrops-icon-prev:before { 114 | content: "\e004"; 115 | } 116 | 117 | /* Demo Buttons Style */ 118 | .codrops-demos { 119 | padding-top: 2em; 120 | font-size: 0.8em; 121 | } 122 | 123 | .codrops-demos a { 124 | display: inline-block; 125 | margin: 0.5em; 126 | padding: 0.7em 1.1em; 127 | outline: none; 128 | border: 2px solid #fff; 129 | text-decoration: none; 130 | text-transform: uppercase; 131 | letter-spacing: 1px; 132 | width: 165px; 133 | } 134 | 135 | .codrops-demos a:hover, 136 | .codrops-demos a.current-demo, 137 | .codrops-demos a.current-demo:hover { 138 | color: #debcc3; 139 | border-color: #debcc3; 140 | } 141 | 142 | @media screen and (max-width: 25em) { 143 | 144 | .codrops-icon span { 145 | display: none; 146 | } 147 | 148 | } 149 | -------------------------------------------------------------------------------- /css/normalize.css: -------------------------------------------------------------------------------- 1 | article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}audio,canvas,video{display:inline-block;}audio:not([controls]){display:none;height:0;}[hidden]{display:none;}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body{margin:0;}a:focus{outline:thin dotted;}a:active,a:hover{outline:0;}h1{font-size:2em;margin:0.67em 0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}pre{white-space:pre-wrap;}q{quotes:"\201C" "\201D" "\2018" "\2019";}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:0;}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend{border:0;padding:0;}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;}button,input{line-height:normal;}button,select{text-transform:none;}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0;} -------------------------------------------------------------------------------- /fonts/codropsicons/codropsicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codrops/FourBoxes/f90ea18ca5ecfe016b98c17fe695a7cedcb9fd24/fonts/codropsicons/codropsicons.eot -------------------------------------------------------------------------------- /fonts/codropsicons/codropsicons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /fonts/codropsicons/codropsicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codrops/FourBoxes/f90ea18ca5ecfe016b98c17fe695a7cedcb9fd24/fonts/codropsicons/codropsicons.ttf -------------------------------------------------------------------------------- /fonts/codropsicons/codropsicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codrops/FourBoxes/f90ea18ca5ecfe016b98c17fe695a7cedcb9fd24/fonts/codropsicons/codropsicons.woff -------------------------------------------------------------------------------- /fonts/codropsicons/license.txt: -------------------------------------------------------------------------------- 1 | Icon Set: Font Awesome -- http://fortawesome.github.com/Font-Awesome/ 2 | License: SIL -- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL 3 | 4 | 5 | Icon Set: Eco Ico -- http://dribbble.com/shots/665585-Eco-Ico 6 | License: CC0 -- http://creativecommons.org/publicdomain/zero/1.0/ -------------------------------------------------------------------------------- /img/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codrops/FourBoxes/f90ea18ca5ecfe016b98c17fe695a7cedcb9fd24/img/1.jpg -------------------------------------------------------------------------------- /img/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codrops/FourBoxes/f90ea18ca5ecfe016b98c17fe695a7cedcb9fd24/img/2.jpg -------------------------------------------------------------------------------- /img/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codrops/FourBoxes/f90ea18ca5ecfe016b98c17fe695a7cedcb9fd24/img/3.jpg -------------------------------------------------------------------------------- /img/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codrops/FourBoxes/f90ea18ca5ecfe016b98c17fe695a7cedcb9fd24/img/4.jpg -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |