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

	<section class="gallery__body">

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

				<header class="poster__header">
					<h1>tonhalle-quartett</h1>
					<ul>
						<li>zürcher</li>
						<li>bläser-quintett</li>
						<li>strawinsky</li>
						<li>schönberg</li>
						<li>honegger</li>
					</ul>
				</header>

				<section class="poster__meta">
					<h2>musica viva</h2>
					<ul>
						<li>donnerstag, 24. april, 10.15 uhr</li>
						<li>tonhalle, kleiner saal</li>
					</ul>
					<dl>
						<dt>igor strawinsky</dt>
						<dd>concertino für streichquartett</dd>
					</dl>
					<dl>
						<dt>arnold schönberg</dt>
						<dd>bläserquintett</dd>
					</dl>
					<dl>
						<dt>arthur honegger</dt>
						<dd>drittes streichquartett</dd>
					</dl>
					<ul>
						<li>vorverkauf tonhallekasse, hug, jecklin, kuoni</li>
						<li>karten fr. 3.30 bis 7.70</li>
					</ul>
				</section>

				<section class="poster__body">
					<div class="poster__body-row poster__body-row--1">
						<div class="circle circle--teal"></div>
					</div>

					<div class="poster__body-row poster__body-row--2">
						<div class="circle circle--brown"></div>
						<div class="circle circle--teal"></div>
						<div class="circle circle--brown"></div>
						<div class="circle circle--teal"></div>
						<div class="circle circle--brown"></div>
						<div class="circle circle--teal"></div>
					</div>

					<div class="poster__body-row poster__body-row--3">
						<div class="circle circle--brown"></div>
					</div>
				</section>

			</div>
			<!-- .poster__content -->
		</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: #BCBCB0;
$teal: #788E8C;
$brown: #9F7F6A;

// Measurements
$base-unit: 8.3333333333%;
$circle-height: 24%;
$border-width: 4px;

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


/**
 * Animations
 */
@keyframes hover {
  0% {
    transform: translateY(-30%);
  }

  100% {
    transform: translateY(30%);
  }
}

@keyframes slide {
  0% {
    transform: translateY(-100%);
  }

  100% {
    transform: translateY(100%);
  }
}


/**
 * 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 {
  @include pos(absolute, auto, auto, 24%, 2%);

  h1,
  li {
    margin: 0;
    font-size: 24px;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }
}

.poster__meta {
  @include pos(absolute, auto, auto, 3%, 2%);

  h2,
  li,
  dl {
    margin: 0;
    font-size: 8px;
    font-weight: bold;
    line-height: 1.4;
  }

  ul {
    margin-top: 8px;
  }

  dt,
  dd {
    display: inline-block;
    margin: 0 5px 0 0;
  }
}

.circle {
  position: absolute;
  width: 100%;
  height: 28.625%;
  border-radius: 50%;

  &--teal {
    z-index: 2;
    background-color: rgba(darken($teal, 6%), .8);
  }

  &--brown {
    z-index: 1;
    background-color: $brown;
  }
}

.poster__body-row {
  position: absolute;
  width: 40%;
  height: 100%;
}

.poster__body-row--1 {
  left: 2%;

  .circle {
    top: 15%;
    animation: hover $duration $timing alternate infinite;
  }
}

.poster__body-row--2 {
  left: 44%;

  .circle {

    &:nth-child(1) {
      top: -15%;
      animation: slide $duration $timing alternate infinite;
    }

    &:nth-child(2) {
      top: 15%;
      animation: slide $duration*1.5 $timing alternate infinite;
    }

    &:nth-child(3) {
      top: 30%;
      animation: slide $duration*2 $timing alternate infinite;
    }

    &:nth-child(4) {
      top: 45%;
      animation: slide $duration*2.5 $timing alternate infinite;
    }

    &:nth-child(5) {
      top: 60%;
      animation: slide $duration*3 $timing alternate infinite;
    }

    &:nth-child(6) {
      top: 90%;
      animation: slide $duration*3.5 $timing alternate infinite;
    }

  }
}

.poster__body-row--3 {
  left: 86%;

  .circle {
    top: 60%;
    animation: hover $duration $timing alternate 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/modernizr/2.8.3/modernizr.min.js