<!-- 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">

				<header class="poster__header">
					<ul>
						<li class="poster__title">végh-quartett</li>
						<li class="poster__title">paul hindemith</li>
						<li class="poster__title">alban berg</li>
						<li class="poster__title">béla bartók</li>
					</ul>
				</header>

				<section class="poster__meta">
					<ul>
						<li class="poster__title">musica viva</li>
						<li>1. kammermusikabend der tonhalle-gesellschaft
							<br/>zürich, donnerstag, den 30.okt 1958, 20.15 uhr
							<br/>kleiner tonhalle-saal</li>
						<li>
							<dl>
								<dt>paul hindemith</dt>
								<dd>drittes streichquartett</dd>
							</dl>
							<dl>
								<dt>alban berg</dt>
								<dd>lyrische suit</dd>
							</dl>
							<dl>
								<dt>béla bartók</dt>
								<dd>viertes streichquartett</dd>
							</dl>
						</li>
						<li>karten zu fr.3.30-7.70
							<br/>vorverkauf tonhalle-kasse, hug, jecklin,
							<br/>kuoni dep.kasse oerlikon der schweiz, kreditanstalt</li>
					</ul>
				</section>

				<section class="poster__body">
					<div class="poster__body-green">
						<div></div>
						<div></div>
						<div></div>
					</div>
					<div class="poster__body-blue">
						<div></div>
						<div></div>
						<div></div>
					</div>
				</section>

				<footer class="poster__footer">
					<p>j. müller-brockmann lorem ipsum dolor</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: #1D95CA;
$green: #257520;
$blue: #1E3779;

// Animations
$timing: cubic-bezier(0.455,  0.030, 0.515, 0.955);
$duration: 1s;


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

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

@keyframes diagonal-slide-reverse {
  0% {
    transform: translateX(100px);
  }

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


/**
 * 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 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: 2%;
  background-color: $primary-color;
  color: black;
  box-shadow: 0 1px 4px 2px rgba(#000,.2);
}

.poster__header,
.poster__meta,
.poster__footer {
    position: absolute;
    transform: rotate(45deg);

    ul li:first-child {
        margin-bottom: 24px;
    }
}

.poster__title {
    font-size: 28px;
    font-weight: bold;
    line-height: 1.2;
}

.poster__header {
    float: left;
    left: 5%;
    bottom: 30%;
    line-height: 1.2;

    ul {
        text-align: right;
    }
}

.poster__meta {
    float: right;
    left: 35%;
    bottom: 9%;
    font-size: 8px;
    font-weight: bold;
    line-height: 1.3;

    dl {
        overflow: hidden;
        margin: 0;
    }

    dt {
        float: left;
        width: 32%;
    }
}

.poster__footer {
    left: 10%;
    bottom: 22%;
    font-size: 4px;
    text-align: right;
}

.poster__body {
    @include pos(absolute, 0, 0, 0, 0);
    width: 200%;
    transform: rotate(45deg);
}

.poster__body-green {
    @include pos(absolute, 40%, auto, auto, -20%);
    animation: diagonal-slide 3s $timing alternate infinite;

    div {
        display: inline-block;
        width: 175px;
        height: 175px;
        margin: 0 1px;
        background-color: $green;
    }
}

.poster__body-blue {
    @include pos(absolute, 47%, 20%, auto, auto);
    animation: diagonal-slide-reverse 3s $timing alternate infinite;

    div {
        display: inline-block;
        width: 250px;
        height: 250px;
        margin: 0 1px;
        background-color: rgba(darken($blue, 5%),0.9);
    }
}
View Compiled
(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/modernizr/2.8.3/modernizr.min.js