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 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

              
                <h1 class="visually-hidden">Welcome to Dogfood</h1>
<section class="galaxy-banner">
  <div class="night">
      <div class="shooting_star"></div>
  <div class="shooting_star"></div>
  <div class="shooting_star"></div>
  <div class="shooting_star"></div>
    <div class="shooting_star"></div>
    <div class="shooting_star"></div>
    <div class="shooting_star"></div>
    <div class="shooting_star"></div>
    <div class="shooting_star"></div>
    <div class="shooting_star"></div>
    <div class="shooting_star"></div>
  </div>
  
  <div class="galaxy-banner-slider layout-page">
    <img class="astronaut astronaut-left" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/dog-astronaut-left.png"/>
  <img class="astronaut astronaut-right" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/dog-astronaut-right.png"/>
    <a class="we-are-trending" href="https://www.instagram.com/explore/tags/csodlife">we're trending <span>#csodlife</span></a>

    <div class="slides-and-profile-container">
      <div class="person-card">
        <div class="profile-photo-star-frame">
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/profile-star-1.png" class="photo-star photo-star-1"/>
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/profile-star-2.png" class="photo-star photo-star-2"/>
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/profile-star-3.png" class="photo-star photo-star-3"/>
          <img src="" class="person-photo"/>
        </div>
        <a href="" class="button dark-blue-button">View Mission <br/>Control</a>
      </div>
      <div class="slides">
        <div class="slider-nav">
      <div class="slide-dot" data-state="active" data-nav-for-slide="1"></div>
    </div>
    <div class="slide" data-slide="1" data-state="active">
      
      <div class="slide-text">        
        <h2>Welcome {FIRSTNAME}!</h2>
        <p>Welcome to the Galaxy new Cornerstars! You're in good company. Get started with essentials needed in your journey and find resources here for your launch. </p>
        <a href="" class="button mint-button">Take Off Here</a>
      </div>
      <div class="featured-image">
        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/Good-Company_Hero.png"/>
      </div>
    </div>
    <div class="slide" data-slide="2" data-state="">
      <div class="slide-text">
        <h2>Second Slide</h2>
        <p>Welcome to the Galaxy new Cornerstars! You're in good company. Get started with essentials needed in your journey and find resources here for your launch. </p>
        <a href="" class="button mint-button">Take Off Here</a>
      </div>
      <div class="featured-image">
        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/Good-Company_Hero.png"/>
      </div>
    </div>
      </div>
  </div>
</section>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Roboto&display=swap");

@font-face {
  font-family: "Goldplay Alt";
  src: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/GoldplayAlt-BoldIt.woff2")
      format("woff2"),
    url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/GoldplayAlt-BoldIt.woff")
      format("woff");
  font-weight: bold;
  font-style: italic;
}

:root {
  --movement-factor: 1;
  --movement-duration: 1s;
}

*,
p,
a {
  font-family: "Roboto", sans-serif;
}

.layout-page {
  max-width: 1440px;
  margin: 0 15px;
}

.galaxy-banner {
  position: relative;
  height: 450px;
  padding-top: 50px;
  box-sizing: border-box;
  color: white;
  display: flex;
  align-items: start;
  justify-content: center;
  background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/csod-dogfood-galaxy-banner-bg.png");
  background-size: cover;
  background-position: center -2vw;
  background-repeat: no-repeat;
  overflow: hidden;
}





.astronaut {
  position: absolute;
  z-index: -1;
  animation: astronaut-hover 7s infinite
    cubic-bezier(0.355, 0.005, 0.575, 0.995);
  transform-origin: center center;
}

.astronaut-left {
  left: -130px;
  top: calc(50% - 40px);
}

.astronaut-right {
  right: -150px;
  animation-delay: -3s;
}

@keyframes astronaut-hover {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-1px, -2px);
  }
  75% {
    transform: translate(2px, 3px) rotate(-1deg);
  }
}

.we-are-trending {
  position: absolute;
  right: 1rem;
  top: -1.5rem;
  font-size: 1rem;
  color: white;
  text-decoration: none;
}

.we-are-trending span {
  font-weight: 100;
  font-style: italic;
}

/* used for screen readers */
.visually-hidden {
  visibility: hidden;
  height: 0;
  margin: 0;
  padding: 0;
}

.galaxy-banner-slider {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 100%;
}

.slider-nav {
  position: absolute;
  width: auto;
  z-index: 2;
  display: flex;
  left: 2rem;
  bottom: -1.8rem;
}

.slide-dot {
  width: 0.8rem;
  height: 0.8rem;
  margin: 0 0.2rem;
  background: transparent;
  border-radius: 50%;
  border: 0.1rem solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 10px gray, inset 0 0 10px #001e7d;
  transition: 0.5s;
  cursor: pointer;
}

.slide-dot[data-state="active"] {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 10px gray;
}

.slides {
  position: relative;
}

.slide {
  display: grid;
  grid-template-columns: 2fr 3fr;
  grid-gap: 0.94rem;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: #0248ba;
  border-radius: 0.6rem;
  padding: 1rem;
  padding-left: 2rem;
  opacity: 0;
  visibility: hidden;
}



.slides-and-profile-container {  
  display: grid;
  grid-template-columns: 2fr 10fr;
  grid-gap: 0.94rem;
}





.slide[data-state="active"] {
  opacity: 1;
  visibility: visible;
}

.slide[data-state="leaving"] {
  animation: leaving var(--movement-duration) forwards;
}

.slide[data-state="entering"] {
  animation: entering var(--movement-duration) forwards;
}

@keyframes entering {
  0% {
    transform: translateX(calc(var(--movement-factor) * 50px));
    opacity: 0;
    visibility: visible;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
  }
}

@keyframes leaving {
  0% {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
  }
  100% {
    transform: translateX(calc(var(--movement-factor) * -50px));
    opacity: 0;
    visibility: hidden;
  }
}

//make the children of the slide move faster
.slide > * {
  --movement-factor: 1.5;
}

.slide > :nth-child(1) {
  animation-delay: 0 !important;
}
.slide > :nth-child(2) {
  animation-delay: 40ms !important;
  animation-duration: calc(var(--movement-duration) * 1.1);
}
.slide > :nth-child(3) {
  animation-delay: 80ms !important;
  animation-duration: calc(var(--movement-duration) * 1.3);
}

.slide[data-state="entering"] > * {
  animation: entering var(--movement-duration) forwards;
}

.slide[data-state="leaving"] > * {
  animation: leaving var(--movement-duration) forwards;
}

.person-card {
  display: flex;
  align-items: center;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
  border-radius: 0.3rem;
  padding: 2rem;
  background: #001e7d;
  margin: 0 1rem 0 0;
  box-shadow: 0 0 20px 5px rgba(5, 5, 5, 0.16);
}

.person-photo {
  display: inline-block;
  width: 138px;
  height: 138px;
  background: white;
  border-radius: 50%;
  opacity: 0;
}

.actual-photo {
  position: absolute;
  left: 0;
  animation: fadein-profile-photo 0.4s forwards cubic-bezier(0.155, 0.865, 0.470, 1.005);
}

@keyframes fadein-profile-photo {
  0% {
    opacity: 0;
  }
  60%{
    transform: scale(1.1);
    box-shadow: 0 0 80px 20px rgba(255, 255, 255, 0.4);
  }
  100% {
    opacity: 1;
  }
}

.profile-photo-star-frame {
  position: relative;
  padding-top: 1rem;  
  margin-bottom: 3rem;
}

.photo-star {
  position: absolute;
  z-index: 1;
}

.photo-star-1 {
  right: -1rem;
  top: -0.5rem;
}

.photo-star-2 {
  bottom: -2rem;
  right: -1rem;
}

.photo-star-3 {
  bottom: -1rem;
}

.slide-text {
  padding-top: 1rem;
}
.slide-text h2 {
  font-size: 2rem;
  font-weight: bold;
  font-style: italic;
  color: white;
  font-family: Goldplay Alt, sans-serif;
  margin-top: 0;
  margin-bottom: 1.2rem;
  margin-left: -0.3rem;
}
.slide-text p {
  max-width: 29rem;
  font-size: 1.1rem;
  line-height: 1.5;
  margin-bottom: 1.3rem;
}

.button {
  display: inline-block;
  text-align: center;
  background: #0248ba;
  color: white;
  text-transform: uppercase;
  border-radius: 0.5rem;
  padding: 0.7rem 1.1rem;
  text-decoration: none;
  line-height: 1.25;
  white-space: nowrap;
  font-size: 0.9rem;
  letter-spacing: 0.3px;
  z-index: 1;
}

.dark-blue-button {
  background: #0248ba;
  color: white;
}

.mint-button {
  background: #3dd6aa;
  color: white;
}

.featured-image {
  align-self: center;
}

.featured-image img {
  width: 100%;
  object-fit: cover;
  border-radius: 9px;
}

/* responsive */

@media (max-width: 1115px) {
  .galaxy-banner {
    height: 700px;
  }
  .slide {
    grid-template-columns: 1fr;
  }
  .slide-text {
    grid-column: 1 / 3;
  }
  .featured-image {
    grid-column: 1 / 3;
  }
}

@media (max-width: 940px) {
  .galaxy-banner {
    height: 600px;
  }
}

@media (max-width: 646px) {
  .galaxy-banner {
    height: 860px;
  }
  .slides-and-profile-container {
    grid-template-columns: 1fr;
  }
  .person-card {
    justify-content: center;
    flex-direction: row;
    padding: 1rem;
    margin: 0;
  }
  .profile-photo-star-frame {
    margin-right: 3rem;
  }
}

/* welcome page specific CSS */
[action*="./Welcome.aspx"] section {
  margin: 0 -19px;
}

[action*="./Welcome.aspx"] .galaxy-banner {
  margin-top: -27px;
}



$shooting-time: 3000ms;
$star-movement: 200px;

.night {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.shooting_star {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 2px;
  background: linear-gradient(-45deg, rgba(95, 145, 255, 1), rgba(0, 0, 255, 0));
  border-radius: 999px;
  filter: drop-shadow(0 0 6px rgba(105, 155, 255, 1));
  transform-origin: left center;
  animation:
    tail $shooting-time ease-in-out infinite,
    shooting $shooting-time ease-in-out infinite,
    delay-animation #{$shooting-time * 4} linear infinite;
  
  &::before, &::after {
    content: '';
    position: absolute;
    top: calc(50% - 1px);
    right: 0;
    height: 2px;
    background: linear-gradient(-45deg, rgba(0, 0, 255, 0), rgba(95, 145, 255, 1), rgba(0, 0, 255, 0));
    transform: translateX(50%) rotate(45deg);
    border-radius: 100%;
    animation: shining $shooting-time ease-in-out infinite;
  }

  &::after {
    transform: translateX(50%) rotate(-45deg);
  }
  
  @for $i from 1 through 20 {
    &:nth-child(#{$i}) {
      $delay: random(9999) + 0ms;
      top: calc(#{random(50) * 1%} - #{$star-movement});
      left: calc(#{random(100) * 1%} - #{$star-movement});
      animation-delay: $delay;
      // opacity: random(50) / 100 + 0.5;
      
      &::before,
      &::after {
        animation-delay: $delay;
      }
    }
  }
}

@keyframes tail {
  0% {
    width: 0;
  }
  
  30% {
    width: 100px;
  }
  
  100% {
    width: 0;
  }
}

@keyframes shining {
  0% {
    width: 0;
  }
  
  50% {
    width: 30px;
  }
  
  100% {
    width: 0;
  }
}

@keyframes shooting {
  0% {
    transform: translate(0, 0) rotate(45deg);
  }
  
  100% {
    transform: translate(300px, 300px) rotate(45deg);
  }
}

@keyframes delay-animation {
  0%{
    opacity: 1;
  }
  25% {
    opacity: 1;
  }
  25.01% {
    opacity: 0;
  }
  100%{
    opacity: 0;
  }
}

              
            
!

JS

              
                const dogfoodGalaxySlider = () => {
  const slider = document.querySelector(".galaxy-banner-slider");
  const sliderNav = document.querySelectorAll(".slider-nav")[0];

  const advanceSlides = (slideToNavigateTo) => {
    const currentSlide = slider.querySelectorAll(
      '.slide[data-state="active"]'
    )[0];
    const currentIndex = parseInt(currentSlide.dataset.slide);
    
    if(slideToNavigateTo == currentIndex) {
      return;
    }
    
    let nextIndex =
      slider.querySelectorAll(".slide").length >= currentIndex + 1
        ? currentIndex + 1
        : 1;
    nextIndex = slideToNavigateTo ? slideToNavigateTo : nextIndex;
    const nextSlide = slider.querySelectorAll(
      '[data-slide="' + nextIndex + '"]'
    )[0];

    console.log({ currentIndex }, { nextIndex });
    //update the slide nav states
    const currentDot = sliderNav.querySelectorAll(
      '[data-nav-for-slide="' + currentIndex + '"]'
    )[0];
    delete currentDot.dataset.state;
    const nextDot = sliderNav.querySelectorAll(
      '[data-nav-for-slide="' + nextIndex + '"]'
    )[0];
    nextDot.dataset.state = "active";

    //update the slide states
    nextSlide.dataset.state = "entering";
    setTimeout(() => {
      nextSlide.dataset.state = "active";
    }, 1000);
    currentSlide.dataset.state = "leaving";
  };

  const configureSliderNav = () => {
    const numSlides = slider.querySelectorAll(".slide").length;
    for (var i = 2; i <= numSlides; i += 1) {
      const newDot = sliderNav
        .querySelectorAll(".slide-dot")[0]
        .cloneNode(true);
      newDot.dataset.navForSlide = i;
      delete newDot.dataset.state;
      sliderNav.appendChild(newDot);
    }

    sliderNav.addEventListener("click", (event) => {
      clearInterval(slideInterval);
      const slideToNavigateTo = event.target.dataset.navForSlide;
      advanceSlides(slideToNavigateTo);
    });

    positionSliderNav();
  };
  
  //any click on the slider will stop the auto-rotate
  slider.querySelectorAll('.slides')[0].addEventListener('click', () => {
    clearInterval(slideInterval);
  });

  const positionSliderNav = () => {
    let maxSlideHeight = 0;
    const slidePosition = slider
      .querySelectorAll(".slide").forEach( slide => {
        maxSlideHeight = maxSlideHeight > slide.getBoundingClientRect().height ? maxSlideHeight : slide.getBoundingClientRect().height;
      });
    sliderNav.style.top = maxSlideHeight + 15 + "px";
  };

  window.addEventListener("resize", () => {
    positionSliderNav();
  });

  //start the auto-rotating
  const slideInterval = setInterval(advanceSlides, 4000);

  configureSliderNav();

  const setProfilePhoto = () => {
    const profileImg = document.getElementById(
      "header_headerResponsive_responsiveNav_imgPhoto"
    ) || { src: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/Galaxy_Chat.png" };
    
    //get a larger version of the photo
    profileImg.src = profileImg.src.replace('/100/', '/200/');
    
    const newPhoto = slider.querySelectorAll(".person-photo")[0].cloneNode(true);
    newPhoto.classList.add('actual-photo');
    newPhoto.src = profileImg.src;
    slider.querySelectorAll(".person-photo")[0].parentNode.appendChild(newPhoto);
    
    if(window.location.host === 'cdpn.io') {
      newPhoto.src = 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/502545/ericllamaupright_54203332-9d65-4913-b11d-2bafe4a8ebf6.jpg'
    }
    
    
    
  };
 

  setProfilePhoto();
};

window.addEventListener("load", () => {
  dogfoodGalaxySlider();
});

              
            
!
999px

Console