<!-- Gallery -->
<main id="js-gallery" role="main" class="gallery">

	<section class="gallery__body">

		<!-- Poster -->
		<div id="js-poster" class="main__gallery-poster poster">
			<div class="poster__content">

				<div class="poster__title poster__title-strawinsky">
					<h2>strawinsky</h2>
				</div>

				<div class="poster__title poster__title-berg">
					<h2>berg</h2>
				</div>

				<div class="poster__title poster__title-fortner">
					<h2>fortner</h2>
				</div>

				<div class="poster__graphic poster__graphic--x">
					<div class="x-1"></div>
					<div class="x-2"></div>
					<div class="x-3"></div>
					<div class="x-4"></div>
					<div class="x-5"></div>
					<div class="x-6"></div>
					<div class="x-7"></div>
					<div class="x-8"></div>
					<div class="x-9"></div>
					<div class="x-10"></div>
					<div class="x-11"></div>
					<div class="x-12"></div>
				</div>

				<div class="poster__graphic poster__graphic--y">
					<div class="y-1"></div>
					<div class="y-2"></div>
					<div class="y-3"></div>
					<div class="y-4"></div>
					<div class="y-5"></div>
					<div class="y-6"></div>
					<div class="y-7"></div>
					<div class="y-8"></div>
					<div class="y-9"></div>
					<div class="y-10"></div>
					<div class="y-11"></div>
					<div class="y-12"></div>
				</div>

				<div class="poster__meta">
					<ul>
						<li>tonhalle grosser saal</li>
						<li>donnerstag, den 6.januar 1955</li>
						<li>10.25 uhr</li>
						<li>12. volkskonzert</li>
						<li>der tonhalle-gesellschaft</li>
					</ul>
					<ul>
						<li>leitung</li>
						<li>erich schmid</li>
						<li>solisten</li>
						<li>touty druey, walter lang, klavier</li>
					</ul>
					<ul>
						<li>i. strawinsky</li>
						<li>symphonie d'instruments a vent</li>
						<li>w. fortner</li>
						<li>fantasie über bach</li>
						<li>für zwei klaviere und orchester</li>
						<li>alban berg</li>
						<li>lulu-sinfonie</li>
					</ul>
					<ul>
						<li>karten zu fr.1.-,2.-und 3.-</li>
						<li>tonhalle-kasse, hug &amp; co., jecklin,</li>
						<li>reisebureau kuoni,</li>
						<li>genossenschaftbuchhandlung</li>
					</ul>
				</div>

				<footer class="poster__footer">
					<p>J. Müller-Brockmann &nbsp; Druck Lithographie &amp; Cartonnage AG Zurich</p>
				</footer>

			</div>
		</div>
		<!-- Poster -->

	</section>
	<!-- .gallery__body -->

</main>
<!-- Gallery -->
/**
 * Mixins
 */
@mixin pos ($position, $top: auto, $right: auto, $bottom: auto, $left: auto) {
  position: $position;
  top: $top;
  right: $right;
  bottom: $bottom;
  left: $left;
}

@mixin center($width: null, $height: null) {
  position: absolute;
  top: 50%;
  left: 50%;
  @if not $width and not $height {
    transform: translate(-50%, -50%);
  } @else if $width and $height {
    width: $width;
    height: $height;
    margin: -($width / 2) #{0 0} -($height / 2)
  } @else if not $height {
    margin-left: -($width / 2);
    transform: translateY(-50%);
    width: $width;
  } @else {
    margin-top: -($height / 2);
    transform: translateX(-50%);
    height: $height;
  }
}


/**
 * Variables
 */
 // Colors
$primary-color: #00449d;

// Animations
$timing: cubic-bezier(0.455,  0.030, 0.515, 0.955);
$duration-slow: 6s;
$duration-med: 3s;
$duration-fast: 1s;


/**
 * Animations
 */
@keyframes x-diagonal-slide-slow {
  0% {
    transform: translateX(-800px);
  }

  100% {
    transform: translateX(800px);
  }
}

@keyframes x-diagonal-slide-med {
  0% {
    transform: translateX(-800px);
  }

  100% {
    transform: translateX(800px);
  }
}

@keyframes x-diagonal-slide-fast {
  0% {
    transform: translateX(-800px);
  }

  100% {
    transform: translateX(800px);
  }
}

@keyframes y-diagonal-slide-slow {
  0% {
    transform: translateX(-800px);
  }

  100% {
    transform: translateX(800px);
  }
}

@keyframes y-diagonal-slide-med {
  0% {
    transform: translateX(-800px);
  }

  100% {
    transform: translateX(800px);
  }
}

@keyframes y-diagonal-slide-fast {
  0% {
    transform: translateX(-800px);
  }

  100% {
    transform: translateX(800px);
  }
}


/**
 * Base
 */
*,
*:after,
*:before {
    box-sizing: border-box;
}

body {
  font-family: "Helvetica Neue","Helvetica", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: bold;
}


/**
 * Gallery
 */
.gallery {
  @include pos(absolute, 0, 0, 0, 0);
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  opacity: 1;
  transition: $duration-fast opacity $timing;
	background: $primary-color;
	background: radial-gradient(ellipse at center, lighten($primary-color, 5%) 0%, $primary-color 100%);

  &.fadeOut {
    opacity: 0;
  }
}

.gallery__body {
  @include center();
  transform-origin: center center;
}


/**
 * Poster
 */
.poster {
  @include center();
  transform-origin: center center;
  display: inline-block;
  vertical-align: middle;

  &:before,
  &:after {
    z-index: -1;
    position: absolute;
    content: "";
    bottom: 15px;
    left: 8px;
    width: 50%;
    top: 80%;
    max-width: 300px;
    background: #777;
    box-shadow: 0 15px 10px rgba(#000,.5);
    transform: rotate(-3deg);
  }

  &:after {
    transform: rotate(3deg);
    right: 8px;
    left: auto;
  }
}

.poster__content {
  position: relative;
  width: 500px;
  height: 700px;
  overflow: hidden;
	padding: 2em 1em;
  background-color: $primary-color;
  color: white;
  box-shadow: 0 1px 4px 2px rgba(#000,.2);
}

.poster__title {
  position: absolute;

  h2 {
    transform: rotate(30deg);
    font-size: 1.75em;
  }
}

.poster__title-strawinsky {
  left: 5px;
  top: 40px;
}

.poster__title-berg {
  top: 298px;
  right: 80px;
}

.poster__title-fortner {
  top: 300px;
  margin-left: 30px;
}

.poster__meta {
  @include pos(absolute, auto, 22%, 2%, auto);
  transform: rotate(30deg);
  font-size: 6px;
  font-weight: bold;
  font-size-adjust: 0.35;
  line-height: 1.5;
  text-align: left;
  letter-spacing: .05em;

  ul {
    margin: 0 0 2.5em;
  }
}

.poster__footer {
  @include pos(absolute, auto, 45%, 12%, auto);
  transform: rotate(-60deg);
  font-size: 3px;
  text-align: left;

  /* Firefox needs this to override min font size */
  font-size-adjust: 0.15;
}

.poster__graphic div {
  position: absolute;
  background: #fff;
  transform: translateZ(0);
  box-shadow: 0 1px 4px rgba(#000,.2);
}

.poster__graphic--x {
  transform: rotate(-60deg);
  z-index: 1;
  margin-left: 35px;
  margin-top: 10px;

  .x-1 {
    left: 245px;
    bottom: -60px;
    width: 60px;
    height: 2px;
    animation: x-diagonal-slide-fast $duration-fast $timing infinite;
  }

  .x-2 {
    left: 208px;
    bottom: -150px;
    width: 100px;
    height: 8px;
    animation: x-diagonal-slide-med $duration-med $timing infinite;
  }

  .x-3 {
    left: 155px;
    bottom: -115px;
    width: 155px;
    height: 30px;
    animation: x-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .x-4 {
    left: 108px;
    bottom: -165px;
    width: 200px;
    height: 2px;
    animation: x-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .x-5 {
    left: -70px;
    bottom: -190px;
    width: 330px;
    height: 12px;
    animation: x-diagonal-slide-med $duration-med $timing infinite;
  }

  .x-6 {
    left: -430px;
    bottom: -190px;
    width: 120px;
    height: 12px;
    animation: x-diagonal-slide-fast $duration-fast $timing infinite;
  }

  .x-7 {
    left: -440px;
    bottom: -115px;
    width: 450px;
    height: 30px;
    animation: x-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .x-8 {
    left: 20px;
    bottom: -60px;
    width: 170px;
    height: 2px;
    animation: x-diagonal-slide-med $duration-med $timing infinite;
  }

  .x-9 {
    left: -350px;
    bottom: -60px;
    width: 260px;
    height: 2px;
    animation: x-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .x-10 {
    left: -360px;
    bottom: -165px;
    width: 370px;
    height: 2px;
    animation: x-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .x-11 {
    left: -270px;
    bottom: -150px;
    width: 370px;
    height: 8px;
    animation: x-diagonal-slide-med $duration-med $timing infinite;
  }

  .x-12 {
    left: -235px;
    bottom: -47px;
    width: 165px;
    height: 12px;
    animation: x-diagonal-slide-slow $duration-slow $timing infinite;
  }
}

.poster__graphic--y {
  transform: rotate(30deg);
  z-index: 1;
  margin-top: -12px;

  .y-1 {
    left: 105px;
    bottom: -95px;
    width: 260px;
    height: 2px;
    animation: y-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .y-2 {
    left: 145px;
    bottom: -150px;
    width: 220px;
    height: 20px;
    animation: y-diagonal-slide-med $duration-med $timing infinite;
  }

  .y-3 {
    left: 105px;
    bottom: -162px;
    width: 220px;
    height: 2px;
    animation: y-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .y-4 {
    left: 105px;
    bottom: -195px;
    width: 160px;
    height: 2px;
    animation: y-diagonal-slide-med $duration-med $timing infinite;
  }

  .y-5 {
    left: 334px;
    bottom: -195px;
    width: 212px;
    height: 2px;
    animation: y-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .y-6 {
    left: 408px;
    bottom: -160px;
    width: 117px;
    height: 2px;
    animation: y-diagonal-slide-fast $duration-fast $timing infinite;
  }

  .y-7 {
    left: 462px;
    bottom: -150px;
    width: 80px;
    height: 20px;
    animation: y-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .y-8 {
    left: 520px;
    bottom: -90px;
    width: 80px;
    height: 2px;
    animation: y-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .y-9 {
    animation: y-diagonal-slide-med $duration-med $timing infinite;
  }

  .y-10 {
    animation: y-diagonal-slide-med $duration-med $timing infinite;
  }

  .y-11 {
    animation: y-diagonal-slide-slow $duration-slow $timing infinite;
  }

  .y-12 {
    animation: y-diagonal-slide-med $duration-med $timing infinite;
  }
}
(function(window, document, undefined) {

    'use strict';


    /**
     * Selectors
     */
    var body = document.body,
        gallery = document.getElementById('js-gallery'),
        galleryWidth = gallery.offsetWidth,
        galleryHeight = gallery.offsetHeight,
        poster = document.getElementById('js-poster'),
        posterWidth = poster.offsetWidth,
        posterHeight = poster.offsetHeight,
        posterPadding = '50';


    /**
     * Prefixed requestAnimationFrame
     */
    var requestAnimationFrame = window.requestAnimationFrame
    || window.webkitRequestAnimationFrame
    || window.mozRequestAnimationFrame
    || window.msRequestAnimationFrame
    || function(callback) {
        return setTimeout(callback, 1000 / 60);
    };


    /**
     * Methods
     */
    var throttle = function(callback, limit) {
        var wait = false;
        return function() {
            if (!wait) {
                callback.call();
                wait = true;
                setTimeout(function() {
                    wait = false;
                }, limit);
            }
        };
    };

    var resizePoster = function() {

        // Define variable
        var scale;

        // Get values for poster dimensions
        scale = Math.min(
            galleryWidth / posterWidth,
            galleryHeight / posterHeight
        );


				// Scale Poster for larger viewports
				poster.style[Modernizr.prefixed('transform')] = 'translate(-50%, -50%) ' + 'scale(' + scale + ')';

        // Sync operation with browser
        requestAnimationFrame(resizePoster);
    };


    var onResize = throttle(function() {

        // Set Gallery width
        galleryWidth = gallery.offsetWidth - posterPadding;

        // Set Gallery height
        galleryHeight = gallery.offsetHeight - posterPadding;

        // Sync operation with browser
        requestAnimationFrame(resizePoster);

    }, 100);


    /**
     * Events/APIs/init
     */

    // Set Gallery width
    galleryWidth = gallery.offsetWidth - posterPadding;

    // Set Gallery height
    galleryHeight = gallery.offsetHeight - posterPadding;

    // Sync operation with browser
    requestAnimationFrame(resizePoster);

    // Listen for resize event
    window.addEventListener('resize', onResize, false);

})(window, document);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js