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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <html>

<head>

  <script>
    function getLocale($city) {
      geocoder = new google.maps.Geocoder();
      geocoder.geocode({
        'address': $city
      }, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
          let $lat = results[0].geometry.location.lat();
          let $long = results[0].geometry.location.lng();
          initMap($lat, $long);
        }
      });
    }

    function initMap($lat, $long) {
      var map = new google.maps.Map(document.getElementById('map'), {
        center: {
          lat: $lat,
          lng: $long
        },
        zoom: 5,
        disableDefaultUI: true,
        styles: [{
            elementType: 'geometry',
            stylers: [{
              color: '#fffdf3'
            }]
          },
          {
            elementType: 'labels.text.stroke',
            stylers: [{
              color: '#fffdf3'
            }]
          },
          {
            elementType: 'labels.text.fill',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'administrative.locality',
            elementType: 'labels.text.fill',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'poi',
            elementType: 'labels.text.fill',
            stylers: [{
              color: '#fffdf3'
            }]
          },
          {
            featureType: 'poi.park',
            elementType: 'geometry',
            stylers: [{
              color: '#8a8983'
            }]
          },
          {
            featureType: 'poi.park',
            elementType: 'labels.text.fill',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'road',
            elementType: 'geometry',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'road',
            elementType: 'geometry.stroke',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'road',
            elementType: 'labels.text.fill',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'road.highway',
            elementType: 'geometry',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'road.highway',
            elementType: 'geometry.stroke',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'road.highway',
            elementType: 'labels.text.fill',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'transit',
            elementType: 'geometry',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'transit.station',
            elementType: 'labels.text.fill',
            stylers: [{
              color: '#d59563'
            }]
          },
          {
            featureType: 'water',
            elementType: 'geometry',
            stylers: [{
              color: '#121314'
            }]
          },
          {
            featureType: 'water',
            elementType: 'labels.text.fill',
            stylers: [{
              color: '#fffdf3'
            }]
          },
          {
            featureType: 'water',
            elementType: 'labels.text.stroke',
            stylers: [{
              color: '#fffdf3'
            }]
          }
        ]
      });
    }
  </script>
</head>

<body>
  <div class="container">
    <div class="control">
      <div class="loading"></div>
      <div class="logo">
        <div class="icon"><span>&pi;</span></div>
        <div class="background"></div>
      </div>
      <form action="" class="entry">
        <input type="text" value="random user" class="name entry__text" name="name" placeholder="Username" />
        <input type="password" value="pa$$w0rd" class="name entry__text" name="name" placeholder="Password" />
        <button class="entry__submit" type="submit">Generate</button>
      </form>
      <div class="avatar"></div>
      <p class="acc_name"></p>
    
    </div>
    <div class="meta">
      <div id="map" class="meta__map"></div>
      <div class="meta__contact">
        <p class="meta__email"><strong><span></span></strong></p>
        <p class="meta__phone">
          <span></span>
        </p>
      </div>
    </div>
 <a href="#" class="close">&#10005;</a>
  </div>
 
 
  <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBUdj34Fv53IrP7rt9uTcKs6ud4F3ooBWw&callback=initMap"></script>
</body>

</html>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Quicksand:200,400,500,700);

$black: #121314;
$black50: #c2c3c4;
$white: #fffdf3;

body,
html {
  height: 100%;
}
* {
  box-sizing: border-box;
  &:focus {
    outline: none;
  }
}
p {
  margin-top: 0;
  margin-bottom: 0.75em;
}
p:last-child {
  margin-bottom: 0;
}

@mixin font {
  font-family: "Quicksand", sans-serif;
  font-weight: 200;
}

@mixin button-animation {
}

body {
  background: #1d1e23;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
  @include font;
}

input {
  @include font;
}
.loading {
  height: 4px;
  width: 4px;
  border-radius: 2px;
  background: $white;
  position: absolute;
  top: 1.5em;
  right: 1.5em;
  opacity: 0.2;
  transition: 0.3s ease-in;
}

.loading.on {
  opacity: 1;
  box-shadow: 0px 0px 10px 0px rgba(255,255,255,0.7);
}

.loading.logout {
 animation: logout 1s ease-out forwards;
}

@keyframes logout {
  0%, 80% {
   opacity: 1;
    background: red;
    box-shadow: 0px 0px 10px 0px red;
  } 
  100% {
  background: white;
    box-shadow: 0px 0px 0px 0px red; 
  }
}
.container {
  height: 330px;
  width: 300px;
  border-radius: 2px;
  transform: rotateX(4deg);

  border-top: 1px solid #242424;
  box-shadow: 0px 370px 20px #00000030;
  transition: all 0.5s ease-out;
  .control {
    position: relative;
    z-index: 2;
    padding: 2.5em;
    border-radius: 2px;
    background: #100e0f;
    height: 330px;
    width: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  .meta {
    width: 0;
    position: absolute;
    background: $white;
    left: 0;
    top: 0;
    border-radius: 3px;
    height: 330px;
    width: 300px;
    transition: 0.5s ease-out;
    display: flex;
    flex-direction: column;
    &__map {
      width: 100%;
   //   display: none;
      flex-grow: 1;
    }
    &__contact {
      padding: 2em;
    }
  }
  .avatar {
    width: 0px;
    height: 0px;
    background: #000;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid #242424;
    border-radius: 75px;
    transition: 0.5s;
    margin-bottom: 1em;
  }
  &.logged-in {
    width: 600px;
    display: flex;
    border-top: 1px solid #323;
    padding: 0;
    position: relative;
    box-shadow: 0px 400px 30px #00000030;
    transform: rotateX(4deg) rotateY(15deg) rotateZ(-5deg) translateY(-40px);
    border-radius: 5px;
    .control, .meta {
      border-radius: 5px;
    }
    .loading {
      background: #b4e861;
        box-shadow: 0px 0px 10px 0px #b4e861;
    }
    .entry {
      display: none;
    }
    .acc_name {
      display: inline;
      color: $white;
    }
    .avatar {
      display: block;
      width: 150px;
      height: 150px;
    }
    .close {
      display: block;
    }
    .control {
      width: 300px;
      z-index: 3;
      .logo {
        position: absolute;
        top: 1.25em;
        left: 1.25em;
        transform: scale(0.66);
      }
    }
    .meta {
      //animation: slide 0.5s ease-out forwards;
      left: 300px;
      &__map {
        display: block;
      }
    }
    .entry__submit {
      display: none;
    }
  }
}

.entry {
  transition: height 0.75s ease-out;
  &__text {
    width: 100%;
    background: transparent;
    border: 0;
    color: $white;
    padding: 0 0 0.5em;
    font-size: 1rem;
    margin-bottom: 1.5em;
    border-bottom: 1px dashed $black50;
  }
  &__submit {
    background: transparent;
    border: 0;
    border-top: 1px solid black;
    width: 100%;
    color: #aaa;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.5s;
    font-size: 1rem;
    text-align: center;
    padding: 1em;
    position: absolute;
    bottom: 0;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 3px;
    left: 0;

    transition: all 0.15s ease-out;
    overflow: hidden;
    &:before {
      content: " ";
      position: absolute;
      border-top: 48px solid #000;
      border-right: 48px solid $black;
      top: 0;
      z-index: -1;
      left: -60px;
      width: 0%;
      height: 100%;
      background: #000000;
      transition: all 0.15s ease-out;
    }
    &:after {
      content: " \2192";
      width: 0;
      display: block;
      position: absolute;
      right: 1em;
      top: calc(50% - 0.5em);
      overflow: hidden;
      transition: all 0.2s ease-out;
    }
    &:hover {
      color: $white;
      &:before {
        width: calc(100%);
        left: 0;
      }
      &:after {
        width: auto;
        margin-left: 0.5em;
      }
    }
  }
}

.close {
  position: absolute;
  width: 1em;
  text-decoration: none;
  color: $white;
  margin-bottom: 0;
  display: none;
  bottom: -40px;
  opacity: 0.2;
  z-index: 999;
  left: 50%;
  overflow: hidden;
  transition: all 0.2s ease-out;
  &:hover {
    opacity: 1;
    transform: scale(1.1);
  }
}
.acc_name {
  display: none;
  color: $white;
  text-transform: capitalize;
}

.addr {
  display: flex;
}
.logo {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  width: 60px;
  margin-bottom: 3em;
}

.icon {
  color: $white;
  font-size: 2.5em;
  grid-column: 1 / 2;
  grid-row: 1;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

.background {
  width: 60px;
  height: 60px;
  transform: rotate(45deg);
  background: transparent;
  border: 1px solid $white;
  grid-column: 1 / 2;
  grid-row: 1;
}

              
            
!

JS

              
                $(".entry__submit").click(function(e) {
  e.preventDefault();
  $('.loading').addClass('on').removeClass('logout');
   login();

});

$(".toggle, .close").click(function(e) {
  e.preventDefault();
  $(".container").toggleClass("logged-in");
  $('.loading').addClass('logout').delay(200).removeClass('on');
});

function login() {
$url = "https://randomuser.me/api/";
  
 fetch($url)
    .then(res => {
      return res.json();
    })
    .then(data => {
      let $data = data.results[0]; 
      let $name = $data.name;
      let $email = $data.email;
      let $photo = $data.picture.large;
      let $street = $data.location.street;
      let $city = $data.location.city;
    console.log($street +  ', ' + $city);
      let $phone = $data.cell;
    
      $('.avatar').css('background-image', 'url(' + $photo + ')');
      $('.acc_name').text($name.first + ' ' + $name.last);

   $('.meta__email span').text($email);
      $('.meta__phone span').text($phone);
   $container = $(".container");
   getLocale($street + ', ' + $city);
  
setTimeout(function() {
 $container.toggleClass("logged-in");
}, 1000); 
    
      
    });
}



              
            
!
999px

Console