Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                    <div id="main-stage"> <!-- START MAIN-STAGE -->
      <div class="conrner-nav"> <!-- START CORNER-NAV -->
        <div id="print" class="media-type">
          <a href="#">
            <span id="title-print" class="title-print"><h2>print</h2></span>
            <img src="https://dummyimage.com/700x521/ffffff/ebebeb.gif" alt="Print Portfolio Samples">
          </a>  
        </div>

        <div id="broadcast" class="media-type">
          <a href="#">
            <span id="title-broadcast"><h2>video</h2></span>
            <img src="https://dummyimage.com/700x488/ffffff/ebebeb.gif" alt="Broadcast Portfolio Samples">
          </a>  
        </div>

        <div id="outdoor" class="media-type">
          <a href="#">
            <span id="title-outdoor"><h2>outdoor</h2></span>
            <img src="https://dummyimage.com/700x705/ffffff/ebebeb.gif" alt="Outdoor Portfolio Samples">
          </a>
        </div>

        <div id="online" class="media-type">
          <a href="#">
            <span id="title-online"><h2>online</h2></span>
            <img src="https://dummyimage.com/700x564/ffffff/ebebeb.gif" alt="Online Portfolio Samples">
          </a>  
        </div>
      </div> <!-- END CORNER-NAV -->
    </div> <!-- END MAIN-STAGE -->
              
            
!

CSS

              
                /* *********************** */
/* ***** Main Styles ***** */
/* *********************** */


/* warm gray */
body {
  overflow: hidden;
  margin: 0;
  padding: 0;
  background-color: #afafaf; 
}


h2 {
  font-size: 2.5rem;
}

/* ********************************* */
/* ******** Section - Styles ******* */
/* ********************************* */
#main-stage {
  width: 100vw;
  height: 100vh; 
}

.conrner-nav {
  width: 100vw;
  height: 100vh; 
}

.media-type {
    position: fixed;
    display: inline-block; 
}

.media-type img {
  position: relative;
  display: inline-block;
  height: 100%; }

#print {
  position: absolute;
  visibility: hidden;
  overflow: hidden;
  background-color: #ffff;
  width: 700px;
  height: 521px;
  top: 50%;
  left: 50%;
  z-index: 2;
}

#broadcast {
  position: absolute;
  visibility: hidden;
  overflow: hidden;
  background-color: #ffff;
  width: 700px;
  height: 488px;
  top: 50%;
  left: 150%;
  z-index: 2;
}

#outdoor {
  position: absolute;
  visibility: hidden;
  overflow: hidden;
  background-color: #ffff;
  width: 700px;
  height: 705px;
  top: 150%;
  left: 50%;
  z-index: 2;
}

#online {
  position: absolute;
  visibility: hidden;
  overflow: hidden;
  background-color: #ffff;
  width: 700px;
  height: 564px;
  top: 150%;
  left: 150%;
  z-index: 2;
}



/* ********************************* */
#title-print {
  position: absolute;
  bottom: 0;
  right: 0;
  margin: 2%;
  z-index: 4; 
}


/* ********************************* */
#title-broadcast {
  position: absolute;
  bottom: 0;
  left: 0;
  margin: 2%;
  z-index: 4; 
}


/* ********************************* */
#title-outdoor {
  position: absolute;
  top: 0;
  right: 0;
  margin: 2%;
  z-index: 4; 
}


/* ********************************* */
#title-online {
  position: absolute;
  top: 0;
  left: 0;
  margin: 2%;
  z-index: 4; 
}

              
            
!

JS

              
                // Custom Javascript


/* ******* GreenSock GSAP Animation ******* */
/* START Onload and on Resize Function */ // $(window).on('load resize', function () {
var tl = new TimelineMax().reverse();
var tlPrint = new TimelineMax().reverse();
var tlBroadcast = new TimelineMax().reverse();
var tlOutdoor = new TimelineMax().reverse();
var tlOnline = new TimelineMax().reverse();

var vw = $(window).width();
var vh = $(window).height();

var print = $("#print");
var broadcast = $("#broadcast");
var outdoor = $("#outdoor");
var online = $("#online");

var titlePrint = $('#title-print');
var titleBroadcast = $('#title-broadcast');
var titleOutdoor = $('#title-outdoor');
var titleOnline = $('#title-online');

var baseWprint = 700;
var baseHprint = 521;

var baseWbroadcast = 700;
var baseHbroadcast = 488;

var baseWoutdoor = 700;
var baseHoutdoor = 705;

var baseWonline = 700;
var baseHonline = 564;


var space = 200;
var ratio = 1;
 

// Add a media query

 var mediaQuerySmall = window.matchMedia("(max-height: 200px)");
    if (mediaQuerySmall.matches) {      
      configScale = .22
    };

var mediaQueryMedium = window.matchMedia("(min-height: 201px) and (max-height: 400px)");
    if (mediaQueryMedium.matches) {      
      configScale = 0.45
    };

var mediaQueryLarge = window.matchMedia("(min-height: 401px) and (max-height: 50000px)");
    if (mediaQueryLarge.matches) {      
      configScale = 0.40
    };

TweenLite.set(print, {
  xPercent: -50,
  yPercent: -50,
  rotation: 15,
  scale: configScale
});

TweenLite.set(broadcast, {
  xPercent: -50,
  yPercent: -50,
  rotation: -15,
  scale: configScale
});

TweenLite.set(outdoor, {
  xPercent: -50,
  yPercent: -50,
  rotation: -15,
  scale: configScale
});

TweenLite.set(online, {
  xPercent: -50,
  yPercent: -50,
  rotation: 15,
  scale: configScale
});


resize();


print.click(function() {
  tlPrint.reversed(!tlPrint.reversed());
});

broadcast.click(function() {
  tlBroadcast.reversed(!tlBroadcast.reversed());
});

outdoor.click(function() {
  tlOutdoor.reversed(!tlOutdoor.reversed());
});

online.click(function() {
  tlOnline.reversed(!tlOnline.reversed());
});


$(window).resize(resize);

TweenLite.set(print, { autoAlpha: 1 });
TweenLite.set(broadcast, { autoAlpha: 1 });
TweenLite.set(outdoor, { autoAlpha: 1 });
TweenLite.set(online, { autoAlpha: 1 });

function resize() {
  
  vw = $(window).width();
  vh = $(window).height();
  
  var r1print = (vw - space) / baseWprint;
  var r2print = (vh - space) / baseHprint;
  
  var r1broadcast = (vw - space) / baseWbroadcast;
  var r2broadcast = (vh - space) / baseHbroadcast;

  var r1outdoor = (vw - space) / baseWoutdoor;
  var r2outdoor = (vh - space) / baseHoutdoor;

  var r1online = (vw - space) / baseWonline;
  var r2online = (vh - space) / baseHonline; 


  ratioPrint = Math.min(r1print, r2print);

  ratioBroadcast = Math.min(r1broadcast, r2broadcast);

  ratioOutdoor = Math.min(r1outdoor, r2outdoor);

  ratioOnline = Math.min(r1online, r2online);
   

  var progress = tl.progress();
  var reversed = tl.reversed();
  tl.seek(0).clear();
  buildTimeline(progress, reversed);
}

/*
// Add a listener 
mediaQuerySmall.addListener(buildTimeline);
mediaQuerySmall2.addListener(buildTimeline);
mediaQueryMedium.addListener(buildTimeline);

buildTimeline(mediaQuerySmall);
buildTimeline(mediaQuerySmall2);
buildTimeline(mediaQueryMedium);
*/

function buildTimeline(progress, reversed) {
  var x = -vw / 2;
  var y = -vh / 2;
  
  //Print Path Values - Center Image on Screen
  var valuesPrint = [
    { x: x, y: y },
    { x: x, y: 0 },
    { x: 0, y: 0 }
  ];

  var bezierPrint = {
    values: valuesPrint,
    type: "quadratic"
  };

           //Print Sub Path Values - to move other Nav Corners off screen 
            var valuesPrintSubPath = [
              { x: x, y: y },
              { x: x*-.5, y: y*-.5 },
              { x: x*-1, y: y*-1 }
            ];

            var bezierPrintSubPath = {
              values: valuesPrintSubPath,
              type: "quadratic"
            };



  //Broadcast Path Values - Center Image on Screen
  var valuesBroadcast = [
    { x: x, y: y },
    { x: x, y: 0 },
    { x: x*2, y: 0 }
  ];

  var bezierBroadcast = {
    values: valuesBroadcast,
    type: "quadratic"
  };

           //Broadcast Sub Path Values - to move other Nav Corners off screen 
            var valuesBroadcastSubPath = [
              { x: x, y: y },
              { x: x*1.5, y: 0 },
              { x: x*2, y: y*-1 }
            ];

            var bezierBroadcastSubPath = {
              values: valuesBroadcastSubPath,
              type: "quadratic"
            };



  //Outdoor Path Values - Center Image on Screen
  var valuesOutdoor = [
    { x: x, y: y },
    { x: x*.75, y: y },
    { x: 0, y: y*2 }
  ];

  var bezierOutdoor = {
    values: valuesOutdoor,
    type: "quadratic"
  };

           //Outdoor Sub Path Values - to move other Nav Corners off screen 
            var valuesOutdoorSubPath = [
              { x: x, y: y },
              { x: x*-.5, y: y*1 },
              { x: x*-1, y: y*2 }
            ];

            var bezierOutdoorSubPath = {
              values: valuesOutdoorSubPath,
              type: "quadratic"
            };



  //Online Path Values - Center Image on Screen
  var valuesOnline = [
    { x: x, y: y },
    { x: x*1.75, y: y },
    { x: x*2, y: y*2 }
  ];

  var bezierOnline = {
    values: valuesOnline,
    type: "quadratic"
  };

           //Online Sub Path Values - to move other Nav Corners off screen 
            var valuesOnlineSubPath = [
              { x: x, y: y },
              { x: x*1.5, y: y*1 },
              { x: x*2, y: y*2 }
            ];

            var bezierOnlineSubPath = {
              values: valuesOnlineSubPath,
              type: "quadratic"
            };


  // Path Values - Original
  var values = [
    { x: x, y: y },
    { x: x, y: 0 },
    { x: 0, y: 0 }
  ];

  var bezier = {
    values: values,
    type: "quadratic"
  };



  TweenLite.set(print, {
    width:  baseWprint * ratioPrint,
    height: baseHprint * ratioPrint,
    x: x,
    y: y
  });

  TweenLite.set(broadcast, {
    width:  baseWbroadcast * ratioBroadcast,
    height: baseHbroadcast * ratioBroadcast,
    x: x,
    y: y
  });

  TweenLite.set(outdoor, {
    width:  baseWoutdoor * ratioOutdoor,
    height: baseHoutdoor * ratioOutdoor,
    x: x,
    y: y
  });

  TweenLite.set(online, {
    width:  baseWonline * ratioOnline,
    height: baseHonline * ratioOnline,
    x: x,
    y: y
  });

  tlPrint.to(print, 1, { bezier: bezierPrint, scale: 1, rotation: 0, force3D: true }, 0)
         .to(titlePrint, .25, { opacity:0, display:"none" }, 0)
         .to(broadcast, 1, { bezier: bezierPrintSubPath, scale: .25, rotation: 0, force3D: true }, 0)  
         .to(outdoor, 1, { bezier: bezierPrintSubPath, scale: .25, rotation: 0, force3D: true }, 0)
         .to(online, 1, { bezier: bezierPrintSubPath, scale: .25, rotation: 0, force3D: true }, 0)
         .progress(progress || 0)
         .reversed(reversed || false);

  tlBroadcast.to(print, 1, { bezier: bezierBroadcastSubPath, scale: .25, rotation: 0, force3D: true }, 0)
             .to(broadcast, 1, { bezier: bezierBroadcast, scale: 1, rotation: 0, force3D: true }, 0)
             .to(titleBroadcast, .25, { opacity:0, display:"none" }, 0)  
             .to(outdoor, 1, { bezier: bezierBroadcastSubPath, scale: .25, rotation: 0, force3D: true }, 0)
             .to(online, 1, { bezier: bezierBroadcastSubPath, scale: .25, rotation: 0, force3D: true }, 0)
             .progress(progress || 0)
             .reversed(reversed || false);

  tlOutdoor.to(print, 1, { bezier: bezierOutdoorSubPath, scale: .25, rotation: 0, force3D: true }, 0)
             .to(broadcast, 1, { bezier: bezierOutdoorSubPath, scale: .25, rotation: 0, force3D: true }, 0)  
             .to(outdoor, 1, { bezier: bezierOutdoor, scale: 1, rotation: 0, force3D: true }, 0)
             .to(titleOutdoor, .25, { opacity:0, display:"none" }, 0)
             .to(online, 1, { bezier: bezierOutdoorSubPath, scale: .25, rotation: 0, force3D: true }, 0)
             .progress(progress || 0)
             .reversed(reversed || false); 

  tlOnline.to(print, 1, { bezier: bezierOnlineSubPath, scale: .25, rotation: 0, force3D: true }, 0)
             .to(broadcast, 1, { bezier: bezierOnlineSubPath, scale: .25, rotation: 0, force3D: true }, 0)  
             .to(outdoor, 1, { bezier: bezierOnlineSubPath, scale: .25, rotation: 0, force3D: true }, 0)
             .to(online, 1, { bezier: bezierOnline, scale: 1, rotation: 0, force3D: true }, 0)
             .to(titleOnline, .25, { opacity:0, display:"none" }, 0)
             .progress(progress || 0)
             .reversed(reversed || false); 
}
// }).resize(); /* END Onload and on Resize Function */ 






              
            
!
999px

Console