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

              
                    <nav> <!-- START Nav -->
       <div id="print" class="media-type">
         <a href="#">
           <div id="printLinkSpace">
              <span id="print-title"></span>
           </div>
         </a>
       </div>
       <div id="broadcast" class="media-type">
          <a href="#">
            <div id="broadcastLinkSpace">
              <span id="broadcast-title"></span>
            </div>
          </a>
       </div>
       <div id="outdoor" class="media-type">
          <a href="#">
            <div id="outdoorLinkSpace">
              <span id="outdoor-title"></span>
            </div>
          </a>
       </div>
       <div id="online" class="media-type">
          <a href="#">
            <div id="onlineLinkSpace">
              <span id="online-title"></span>
            </div>
          </a>
       </div>
    </nav> <!-- END Nav -->

    <div class="center-name-and-tag"> <!-- START Name and Tag -->
      <div class="name-and-tag">
        <p id="name-title">Name and Title</p>
        <p id="tagline">tagline goes here</p>
        <p class="nav-cal-txt">Nav img w calc <input class=".nav-cal-txt" type="text" id="t1" /></p>
      </div>
    </div> <!-- END Name and Tag -->
              
            
!

CSS

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

h2 {
  font-size: 1rem;
}


/* ******************************************** */
/* ***** For Dev Only - REMOVE FROM FINAL ***** */
/* ******************************************** */
div {
  border: 1px solid red; 
}

div #printLinkSpace {
  border: 3px solid orange; 
}

span {
  border: 1px solid green; 
}



/* *************************************** */
/* ******** Title Landing - Styles ******* */
/* *************************************** */
.center-name-and-tag {
  position: fixed;
  width: 100vw;
  height: 100vh;
  z-index: -1; }

.name-and-tag {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center; }

#name-title {
  width: 100vw;
  font-family: "Trebuchet MS", Helvetica, sans-serif;
  line-height: .55;
  font-weight: normal;
  font-stretch: normal;
  font-variant: normal;
  font-size: 18px;}

		@media all and (max-height: 400px) {
		#name-title {
		    line-height: .25;
		    font-size: 16px; }}

		#tagline { 
		  width: 100vw; 
		  font-family: "Courier New", Courier, monospace;
		  line-height: .25;
		  font-weight: normal;
		  font-stretch: normal;
		  font-variant: normal;
		  font-size: 16px; }

		@media all and (max-height: 400px) {
		#tagline {
		    font-size: 14px; }}

.nav-cal-txt {
	font-family: "Courier New", Courier, monospace;
	font-size: .75rem;
}
 

/* ***************************** */
/* ******** Nav - Styles ******* */
/* ***************************** */    

nav > div {
 position: fixed;
 display: block;
 cursor: pointer;
 
 background: #fff;
 width: 180px;
 height: 100px;
}

nav > div > h2 {
 position: absolute;
}

nav > #print {
 width: 700px;
 height: 521px;
 background-image: url('https://dummyimage.com/700x521/ffffff/ebebeb.gif');
 background-size: contain;
 background-repeat: no-repeat;
 background-position: center center;
 left: 0;
 top: 0;
 z-index: 1;
}

#print-title {
 position: absolute;
 padding: 0% 0% 7% 25%;
 margin: 45% 0% 0% 65%;
 background: #D3D4D1;
 background-image: url('https://dummyimage.com/306x84/bdb0bd/ffffff.gif&text=print');
 background-size: contain;
 background-repeat: no-repeat;
 background-position: center center;
 text-align: right;
 right: 0;
 bottom: 0;
 z-index: 2;
}

#print-title:hover {
  z-index: 6;
  background-image: url('https://dummyimage.com/306x84/ff8787/ffffff.gif&text=print') !important; 
} /* Note you need !important to overide the background image set by javascript */

#print:hover #print-title {
    z-index: 6;
    background-image: url('https://dummyimage.com/306x84/ff8787/ffffff.gif&text=print') !important; 
  } /* Note you need !important to overide the background image set by javascript */
    /* Note not all browsers allow for this so the previous CSS hover is a fallback */

nav > #broadcast {
 width: 700px;
 height: 488px;
 background-image: url('https://dummyimage.com/700x488/ffffff/ebebeb.gif');
 background-size: contain;
 background-repeat: no-repeat;
 background-position: center center;
 right: 0;
 top: 0;
 z-index: 1;
}

#broadcast-title {
 position: absolute;
 padding: 0% 0% 7% 28%;
 margin: 45% 0% 0% 0%;
 background: #D3D4D1;
 background-image: url('https://dummyimage.com/308x77/bdb0bd/ffffff.gif&text=video');
 background-size: contain;
 background-repeat: no-repeat;
 background-position: center center;
 text-align: left;
 left: 0;
 bottom: 0;
 z-index: 2;
}

#broadcast-title:hover {
  z-index: 6;
  background-image: url('https://dummyimage.com/308x77/ff8787/ffffff.gif&text=video') !important; 
} /* Note you need !important to overide the background image set by javascript */

#broadcast:hover #broadcast-title {
    z-index: 6;
    background-image: url('https://dummyimage.com/308x77/ff8787/ffffff.gif&text=video') !important; 
  } /* Note you need !important to overide the background image set by javascript */
    /* Note not all browsers allow for this so the previous CSS hover is a fallback */


nav > #outdoor {
 width: 700px;
 height: 705px;
 background-image: url('https://dummyimage.com/700x705/ffffff/ebebeb.gif');
 background-size: contain;
 background-repeat: no-repeat;
 background-position: center center; 
 left: 0;
 bottom: 0;
 z-index: 1;
}

#outdoor-title {
 position: absolute;
 padding: 0% 0% 7% 32%;
 margin: 0% 0% 0% 52%;
 background: #D3D4D1;
 background-image: url('https://dummyimage.com/395x85/bdb0bd/ffffff.gif&text=outdoor');
 background-size: contain;
 background-repeat: no-repeat;
 background-position: center center;
 text-align: right;
 right: 0;
 top: 0;
 z-index: 2;
}

#outdoor-title:hover {
  z-index: 6;
  background-image: url('https://dummyimage.com/395x85/ff8787/ffffff.gif&text=outdoor') !important; 
} /* Note you need !important to overide the background image set by javascript */

#outdoor:hover #outdoor-title {
    z-index: 6;
    background-image: url('https://dummyimage.com/395x85/ff8787/ffffff.gif&text=outdoor') !important; 
  } /* Note you need !important to overide the background image set by javascript */
    /* Note not all browsers allow for this so the previous CSS hover is a fallback */


nav > #online {
 width: 700px;
 height: 564px;
 background-image: url('https://dummyimage.com/700x564/ffffff/ebebeb.gif');
 background-size: contain;
 background-repeat: no-repeat;
 background-position: center center;
 right: 0;
 bottom: 0;
 z-index: 1;
}

#online-title {
 position: absolute;
 padding: 0% 0% 7% 33%;
 margin: 0% 0% 0% 0%;
 background: #D3D4D1;
 background-image: url('https://dummyimage.com/368x78/bdb0bd/ffffff.gif&text=online');
 background-size: contain;
 background-repeat: no-repeat;
 background-position: center center;
 text-align: left;
 left: 0;
 top: 0;
 z-index: 2;
}

#online-title:hover {
  z-index: 6;
  background-image: url('https://dummyimage.com/368x78/ff8787/ffffff.gif&text=online') !important; 
} /* Note you need !important to overide the background image set by javascript */

#online:hover #online-title {
    z-index: 6;
    background-image: url('https://dummyimage.com/368x78/ff8787/ffffff.gif&text=online') !important; 
  } /* Note you need !important to overide the background image set by javascript */
    /* Note not all browsers allow for this so the previous CSS hover is a fallback */


/* ****************************************************** */
/* ****** Nav Maintain Image Aspect Ratio on Scale ****** */
/* ****************************************************** */
.media-type > img {
    max-width:100%;
    width:100%;
    height:auto;
}
              
            
!

JS

              
                // Custom Javascript



/* ****** Start GreenSock ****** */

// START Onload and on Resize Function 
// $(window).on('load resize', function () {

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

var print = {id:"#print", 
             start:{x:-50, y:-50, rot:15},
             center:{x:1, y:1},
             end:{x:-200, y:-200},
            },
    broadcast = {id:"#broadcast",
                 start:{x:50, y:-50, rot:-15},
                 center:{x:-1, y:1},
                 end:{x:200, y:-200}
                },
    outdoor = {id:"#outdoor",
               start:{x:-50, y:50, rot:-15},
               center:{x:1, y:-1},
               end:{x:-200, y:200}
              },
    online = {id:"#online",
              start:{x:50, y:50, rot:15},
              center:{x:-1, y:-1},
              end:{x:200, y:200}
             },
    buttons = [print, broadcast, outdoor, online],
    current = null,
    tween = null;

// Add a media query

var space = function() {
if(vw < vh) {
  space = "vw";}
else {space = "vh"}; 
};

space();

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

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

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

  var mediaQueryMedium = window.matchMedia("(min-width: 500px) and (max-width: 700px)");
      if (mediaQueryMedium.matches) {      
        configScale = 55
      };

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

  var mediaQueryLarge = window.matchMedia("(min-width: 700px)");
      if (mediaQueryLarge.matches) {      
        configScale = 60
      };

  var configSize = configScale + space;

  var txt = document.getElementById("t1");
  txt.value = '"' + configScale + space + '"';





// Initial positioning of the buttons
buttons.forEach(initialSet);

function initialSet(element, index, array) {
  TweenMax.set(element.id, {
   xPercent:element.start.x,
   yPercent:element.start.y,
   rotation:element.start.rot,
   backgroundColor: "none", 
   width: configSize, 
   height: "auto"
  });
}



// Click events
$(print.id).click(onClick);
$(broadcast.id).click(onClick);
$(outdoor.id).click(onClick);
$(online.id).click(onClick);


function onClick(e) {
 var trg = e.currentTarget;
  
 if(!tween) {
  
  current = checkTween(trg);
  
  // Move everyone out except the current one
  var remainder = buttons.filter(checkArray);
  remainder.forEach(moveOut);
    
  tween = createTween(current);
  
 } else {
  
  // Move everyone back except the current one - Do a check on the array for that
  var remainder = buttons.filter(checkArray);
  remainder.forEach(moveBack);
  
  // Rewind the main tween
  tween.reverse();
  
 }
}

function checkTween(trg) {
 switch(trg.id) {
  case "print":
   return print;
   break;

  case "broadcast":
   return broadcast;
   break;

  case "outdoor":
   return outdoor;
   break;   

  case "online":
   return online;
   break;
   
  default:
   return null;
 }
}



function checkArray(value) {
 return value != current; 
}



function moveOut(element) {
 TweenMax.to(element.id, 0.7, {
  x:element.end.x,
  y:element.end.y,
  ease:Power2.easeInOut
 });
}

function moveBack(element) {
 TweenMax.to(element.id, 0.7, {
  x:0,
  y:0,
  ease:Power2.easeInOut
 });
}


var configSizeLarge = configScale + 25 + space;

function createTween(element, progress, reversed) {
 return TweenMax.to(element.id, 1, {
   bezier:[
    {x:0, y:0},
    {x:(element.center.x*vw)/4, y:(element.center.y*vh)/2.5},
    {x:(element.center.x*vw)/2, y:(element.center.y*vh)/2}
   ],
   rotation:0,
   width: configSizeLarge,
   height: "80vh",
   ease:Power2.easeInOut,
   onReverseComplete: function() {
    // Flush the tween
    tween = null;
   }
  })
  .progress(progress || 0)
  .reversed(reversed || false);
}




// Window events
$(window).resize(resize);


function resize() {
 // Update the center of the screen
 vw = $(window).width();
 vh = $(window).height();

 


 // Update the size of the Nav


// Add a media query

var space = function() {
if(vw < vh) {
  space = "vw";}
else {space = "vh"}; 
};

space();

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

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

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

  var mediaQueryMedium = window.matchMedia("(min-width: 500px) and (max-width: 700px)");
      if (mediaQueryMedium.matches) {      
        configScale = 55
      };

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

  var mediaQueryLarge = window.matchMedia("(min-width: 700px)");
      if (mediaQueryLarge.matches) {      
        configScale = 60
      };

  var configSize = configScale + space;

  var txt = document.getElementById("t1");
  txt.value = '"' + configScale + space + '"';

// End Update size of Nav

 
 if(tween) {  
  // Grab tween's progress and record it
  var progress = tween.progress(),
      reversed = tween.reversed();

  // Recreate the tween
  tween.pause(0);
  tween = null;
  tween = createTween(current, progress, reversed);
 }
}
// }).resize(); /* END Onload and on Resize Function */ 








              
            
!
999px

Console