uses the next as a template<html lang="en"><head>
  <meta charset="UTF-8">
  

    <link rel="apple-touch-icon" type="image/png" href="https://cpwebassets.codepen.io/assets/favicon/apple-touch-icon-5ae1a0698dcc2402e9712f7d01ed509a57814f994c660df9f7a952f3060705ee.png">

    <meta name="apple-mobile-web-app-title" content="CodePen">

    <link rel="shortcut icon" type="image/x-icon" href="https://cpwebassets.codepen.io/assets/favicon/favicon-aec34940fbc1a6e787974dcd360f2c6b63348d4b1f4e06c77743096d55480f33.ico">

    <link rel="mask-icon" type="image/x-icon" href="https://cpwebassets.codepen.io/assets/favicon/logo-pin-b4b4269c16397ad2f0f7a01bcdf513a1994f4c94b8af2f191c09eb0d601762b1.svg" color="#111">



  
    <script src="https://cpwebassets.codepen.io/assets/common/stopExecutionOnTimeout-2c7831bb44f98c1391d6a4ffda0e1fd302503391ca806e7fcc7b9b87197aec26.js"></script>


  <title>CodePen - 3D Website Rotate;</title>

    <link rel="canonical" href="https://codepen.io/khesehang-samsohang/pen/VwJqMdW">
  
  
  
  
<style>
body {
    font-family: "Open Sans", sans-serif;
    font-weight: 300;
  background-image: linear-gradient( 135deg, #2AFADF 10%, #4C83FF 100%);
}

ul {
    list-style: none;
    padding: 0;
    margin: 0
}

li {
    list-style: none
}

.inline-block {
    display: inline-block
}

.act-table {
    display: table
}

.act-table-cell {
    display: table-cell
}

a,
a:hover,
a:focus,
a:active {
    text-decoration: none;
    color: inherit
}

.text-center {
    text-align: center
}

.text-left {
    text-align: left
}

.text-right {
    text-align: right
}

.pull-right {
    float: right
}

.pull-left {
    float: left
}

.ver-middle {
    vertical-align: middle
}

header {
    position: fixed;
    top: 8px;
    left: 0;
    right: 0;
    z-index: 100;
    transition: 1s;
    -webkit-transition: 1s;
    -moz-transition: 1s
}

header.go-out {
    top: -150px
}

header nav ul {
    background-color: rgba(255, 255, 255, 0.2);
    overflow: hidden;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px
}

header nav ul li {
    color: #fff
}

header nav ul li a {
    width: 100px;
    max-width: 150px;
    height: 32px;
    display: block;
    padding-top: 13px
}

header nav ul li.active a,
header nav ul li.active a:hover {
    background-color: rgba(255, 255, 255, 0.2)
}

header nav ul li:hover a {
    background-color: rgba(255, 255, 255, 0.1)
}

.page {
    background-color: rgba(0, 0, 0, 0.2)
}

.page .act-table {
    width: 100%;
    height: 100%
}

.page .act-table .act-table-cell {
    font-size: 100px;
    font-weight: 500;
    color: #fff
}

.page.active {
    z-index: 50
}

#wrap {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    transition: .8s;
    -webkit-transition: .8s;
    -moz-transition: .8s
}

#wrap.active {
    top: 10%;
    bottom: 10%;
    right: 10%;
    left: 10%
}

.cube {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    -webkit-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    -moz-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    transition: 1s;
    -webkit-transition: 1s;
    -moz-transition: 1s
}

.cube.reverse-back {
    transform: rotateX(180deg) rotateY(0deg) rotateZ(-180deg);
    -webkit-transform: rotateX(180deg) rotateY(0deg) rotateZ(-180deg);
    -moz-transform: rotateX(180deg) rotateY(0deg) rotateZ(-180deg)
}

.cube.reverse-back .back {
    transform: translateZ(-800px) rotateY(-180deg);
    -webkit-transform: translateZ(-800px) rotateY(-180deg);
    -moz-transform: translateZ(-800px) rotateY(-180deg)
}

.cube.reverse-left .left {
    transform: translateX(-800px) rotateY(-90deg);
    -webkit-transform: translateX(-800px) rotateY(-90deg);
    -moz-transform: translateX(-800px) rotateY(-90deg)
}

.cube.reverse-right {
    transform: rotateX(0deg) rotateY(270deg) rotateZ(0deg);
    -webkit-transform: rotateX(0deg) rotateY(270deg) rotateZ(0deg);
    -moz-transform: rotateX(0deg) rotateY(270deg) rotateZ(0deg)
}

.cube.reverse-right .right {
    transform: translateX(800px) rotateY(90deg);
    -webkit-transform: translateX(800px) rotateY(90deg);
    -moz-transform: translateX(800px) rotateY(90deg)
}

.cube.reverse-top {
    transform: rotateX(-90deg) rotateY(0deg) rotateZ(0deg);
    -webkit-transform: rotateX(-90deg) rotateY(0deg) rotateZ(0deg);
    -moz-transform: rotateX(-90deg) rotateY(0deg) rotateZ(0deg)
}

.cube.reverse-top .top {
    transform: translateY(-400px) rotateX(90deg);
    -webkit-transform: translateY(-400px) rotateX(90deg);
    -moz-transform: translateY(-400px) rotateX(90deg)
}

.cube.reverse-bottom .bottom {
    transform: translateY(400px) rotateX(-90deg);
    -webkit-transform: translateY(400px) rotateX(-90deg);
    -moz-transform: translateY(400px) rotateX(-90deg)
}

.face {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    color: #666;
    font-size: 18px;
    text-align: center;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.5);
    -webkit-box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.5);
    -moz-box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.5)
}

.front {
   background-image: linear-gradient( 135deg, #CE9FFC 10%, #7367F0 100%);
}

.front.active {
    transform: translateZ(800px);
    -webkit-transform: translateZ(800px);
    -moz-transform: translateZ(800px)
}

.back {
   background-image: linear-gradient( 135deg, #FEB692 10%, #EA5455 100%);
}

.back:not(.active) {
    transform: translateZ(-800px) rotateY(-180deg);
    -webkit-transform: translateZ(-800px) rotateY(-180deg);
    -moz-transform: translateZ(-800px) rotateY(-180deg)
}

.back .active {
    transform: translateZ(800px);
    -webkit-transform: translateZ(800px);
    -moz-transform: translateZ(800px)
}

.left:not(.active) {
    transform: translateX(-800px) rotateY(-90deg);
    -webkit-transform: translateX(-800px) rotateY(-90deg);
    -moz-transform: translateX(-800px) rotateY(-90deg)
}

.left .active {
    transform: translateZ(800px);
    -webkit-transform: translateZ(800px);
    -moz-transform: translateZ(800px)
}

.right {
    background-image: linear-gradient( 135deg, #43CBFF 10%, #9708CC 100%);
}

.right:not(.active) {
    transform: translateX(800px) rotateY(90deg);
    -webkit-transform: translateX(800px) rotateY(90deg);
    -moz-transform: translateX(800px) rotateY(90deg)
}

.right .active {
    transform: translateZ(800px);
    -webkit-transform: translateZ(800px);
    -moz-transform: translateZ(800px)
}

.top {
   background-image: linear-gradient( 135deg, #F761A1 10%, #8C1BAB 100%);
}

.top:not(.active) {
    transform: translateY(-400px) rotateX(90deg);
    -webkit-transform: translateY(-400px) rotateX(90deg);
    -moz-transform: translateY(-400px) rotateX(90deg)
}

.top .active {
    transform: translateZ(800px);
    -webkit-transform: translateZ(800px);
    -moz-transform: translateZ(800px)
}

.bottom:not(.active) {
    transform: translateY(400px) rotateX(-90deg);
    -webkit-transform: translateY(400px) rotateX(-90deg);
    -moz-transform: translateY(400px) rotateX(-90deg)
}

.bottom .active {
    transform: translateZ(800px);
    -webkit-transform: translateZ(800px);
    -moz-transform: translateZ(800px)
}
</style>

  <script>
  window.console = window.console || function(t) {};
</script>

  
  
<style id="_goober"> .go1475592160{height:0;}.go1671063245{height:auto;}.go1888806478{display:flex;flex-wrap:wrap;flex-grow:1;}@media (min-width:600px){.go1888806478{flex-grow:initial;min-width:288px;}}.go167266335{background-color:#313131;font-size:0.875rem;line-height:1.43;letter-spacing:0.01071em;color:#fff;align-items:center;padding:6px 16px;border-radius:4px;box-shadow:0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12);}.go3162094071{padding-left:20px;}.go3844575157{background-color:#313131;}.go1725278324{background-color:#43a047;}.go3651055292{background-color:#d32f2f;}.go4215275574{background-color:#ff9800;}.go1930647212{background-color:#2196f3;}.go946087465{display:flex;align-items:center;padding:8px 0;}.go703367398{display:flex;align-items:center;margin-left:auto;padding-left:16px;margin-right:-8px;}.go3963613292{width:100%;position:relative;transform:translateX(0);top:0;right:0;bottom:0;left:0;min-width:288px;}.go1141946668{box-sizing:border-box;display:flex;max-height:100%;position:fixed;z-index:1400;height:auto;width:auto;transition:top 300ms ease 0ms,right 300ms ease 0ms,bottom 300ms ease 0ms,left 300ms ease 0ms,max-width 300ms ease 0ms;pointer-events:none;max-width:calc(100% - 40px);}.go1141946668 .notistack-CollapseWrapper{padding:6px 0px;transition:padding 300ms ease 0ms;}@media (max-width:599.95px){.go1141946668{width:100%;max-width:calc(100% - 32px);}}.go3868796639 .notistack-CollapseWrapper{padding:2px 0px;}.go3118922589{top:14px;flex-direction:column;}.go1453831412{bottom:14px;flex-direction:column-reverse;}.go4027089540{left:20px;}@media (min-width:600px){.go4027089540{align-items:flex-start;}}@media (max-width:599.95px){.go4027089540{left:16px;}}.go2989568495{right:20px;}@media (min-width:600px){.go2989568495{align-items:flex-end;}}@media (max-width:599.95px){.go2989568495{right:16px;}}.go4034260886{left:50%;transform:translateX(-50%);}@media (min-width:600px){.go4034260886{align-items:center;}}</style></head>

<body translate="no">
  <header class="">
  <nav class="text-center">
    <ul class="inline-block">
      <li class="pull-left active"><a href="#" data-direction="front">Home</a></li>
      <li class="pull-left"><a href="#" data-direction="back">Portfolio</a></li>
      <li class="pull-left"><a href="#" data-direction="top">About</a></li>
      <li class="pull-left"><a href="#" data-direction="right">Contact</a></li>
      <div class="clearfix"></div>
    </ul>
  </nav>
</header>
<div id="wrap" class="">
  <div class="cube reverse-front">
    <section class="page active face front" id="home">
      <div class="act-table text-center">
        <div class="act-table-cell ver-middle">Home Page</div>
      </div>
    </section>
     <section class="page  face back" id="portfolio">
      <div class="act-table text-center">
        <div class="act-table-cell ver-middle">Portfolio Page</div>
      </div>
    </section>
     <section class="page face top" id="about">
      <div class="act-table text-center">
        <div class="act-table-cell ver-middle">about Page</div>
      </div>
    </section>
     <section class="page  face right" id="contact">
      <div class="act-table text-center">
        <div class="act-table-cell ver-middle">Contact Page</div>
      </div>
    </section>
     <section class="page  face bottom" id="blog">
      <div class="act-table text-center">
        <div class="act-table-cell ver-middle">blog Page</div>
      </div>
    </section>
     <section class="page  face left" id="article">
      <div class="act-table text-center">
        <div class="act-table-cell ver-middle">article Page</div>
      </div>
    </section>
  </div>
</div>
  
      <script id="rendered-js">
document.addEventListener('DOMContentLoaded', function () {
  // Variables
  var windowWidth = window.innerWidth;
  var windowHeight = window.innerHeight;
  var header = document.querySelector('header');
  var wrap = document.querySelector('#wrap');
  var cubes = document.querySelectorAll('.cube');
  var headerLinks = document.querySelectorAll('header nav li a');

  // header anchor tags
  function headerAnchors() {
    var pageDirection = '';
    var timeout;

    headerLinks.forEach(function (link) {
      link.addEventListener('click', function (event) {
        event.preventDefault();

        // Remove previous direction class
        cubes.forEach(function (cube) {
          cube.classList.remove('reverse-' + pageDirection);
        });

        // Set new direction
        pageDirection = link.dataset.direction;
        var reverseDirection = link.dataset.reverseDirection;

        // Update classes
        link.parentElement.classList.add('active');
        header.querySelectorAll('nav li').forEach(function (li) {
          if (li !== link.parentElement) {
            li.classList.remove('active');
          }
        });
        cubes.forEach(function (cube) {
          cube.classList.add('reverse-' + pageDirection);
        });

        header.classList.add('go-out');
        wrap.classList.add('active');

        // Reset classes after timeout
        clearTimeout(timeout);
        timeout = setTimeout(function () {
          header.classList.remove('go-out');
          wrap.classList.remove('active');
        }, 1000);
      });
    });
  }

  headerAnchors();

  window.addEventListener('resize', function () {
    // Update window dimensions
    windowWidth = window.innerWidth;
    windowHeight = window.innerHeight;
    // Perform additional functions if needed
  });
});
//# sourceURL=pen.js
    </script>

  



</body></html>