Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <body class="body">
  <div class="greenline"></div>

  <div class="main-wrapper">

    <section class="section" style="background-color: red"></section>

    <section id="gather" class="section section--showcase">

      <div class="showcase">
        
        <div class="project a-project a-project-1" data-title="Data Title 1" data-meta="Data Meta 01">
          <div class="gallery a-gallery a-gallery-0">

            <div class="image a-image a-image-1" data-caption="Data Caption 1">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/086A2033-1024x683.jpg" style="height:100%" />
            </div>

            <div class="image a-image a-image-2" data-caption="Data Caption 2">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/086A7527-1024x683.jpg" style="height:100%" />
            </div>

            <div class="image a-image a-image-3" data-caption="Data Caption 3">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/086A7538-1024x683.jpg" style="height:100%" />
            </div>

            <div class="image a-image a-image-4" data-caption="Data Caption 4">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/086A8100-1024x683.jpg" style="height:100%" />
            </div>

            <div class="image a-image a-image-5" data-caption="Data Caption 5">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/086A8236-1024x683.jpg" style="height:100%" />
            </div>

          </div>

        </div>

        <div class="project a-project a-project-2" data-title="Data Title 2" data-meta="Data Meta 02">

          <div class="gallery a-gallery a-gallery-0">

            <div class="image a-image a-image-1" data-caption="Data Caption 6">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/086A8975-1-1024x1024.jpg" style="height:100%" />
            </div>

            <div class="image a-image a-image-2" data-caption="Data Caption 7">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/086A8847-1024x1024.jpg" style="height:80%" />
            </div>

            <div class="image a-image a-image-3" data-caption="Data Caption 8">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/086A8863-2-1-1024x683.jpg" style="height:70%" />
            </div>

            <div class="image a-image a-image-4" data-caption="Data Caption 9">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/086A8890-1024x1024.jpg" style="height:90%" />
            </div>

          </div>

        </div>

        <div class="project a-project a-project-3" data-title="Data Title 3" data-meta="Data Meta 3">

          <div class="gallery a-gallery a-gallery-0">

            <div class="image a-image a-image-1" data-caption="Data Caption 10">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/Drew-Nocente-1024x683.jpg" style="height:100%" />
            </div>

            <div class="image a-image a-image-2" data-caption="Data Caption 11">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/Drew-Food-Workshop-1024x683.jpg" style="height:100%" />
            </div>

          </div>

        </div>

        <div class="project a-project a-project-4" data-title="Data Title 4" data-meta="Data Meta 4">

          <div class="gallery a-gallery a-gallery-0">

            <div class="image a-image a-image-1" data-caption="Data Caption 12">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/Maha-Co-1-1-1024x683.jpg" style="height:100%" />
            </div>

            <div class="image a-image a-image-2" data-caption="Data Caption 13">
              <img src="https://reroutefest.com/wp-content/uploads/2022/09/Maha-Co-2-1-1024x683.jpg" style="height:100%" />
            </div>

            <div class="image a-image a-image-3" data-caption="Data Caption 14">
              <img src="" style="height:100%" />
            </div>

          </div>

        </div>

        <div class="info-wrapper a-info-wrapper fixed-section">
          <div class="project-info a-project-info">
            <div class="work-title a-work-title rift"></div>
            <div class="meta-info a-meta-info"></div>
          </div>
          <div class="img-caption a-img-caption"></div>
        </div>

      </div>

    </section>

    <section class="section" style="background-color: purple;">
    </section>

  </div>
              
            
!

CSS

              
                section,
.showcase {
  height: 100vh;
}
.showcase,
.gallery,
.image {
  display: flex;
  flex-wrap: nowrap;
  position: relative;
  align-items: center;
}
.image {
  height: 30vh;
}
.info-wrapper {
  position: absolute;
  left: 0;
  bottom: 5%;
  color: black;
}
.greenline {
  border: 1px solid green;
  height: 100vh;
  width: 1px;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 50%;
}

              
            
!

JS

              
                gsap.registerPlugin(ScrollTrigger);

// Dynamic image class names for sections
const aImages = gsap.utils.toArray(".a-image");
aImages.map((v, i) => {
  v.className = `image a-image a-image-${i + 1}`;
});

// Getting the elements for manipulation
const a_textSection = document.querySelector(".a-fixed-section");
const a_workTitle = document.querySelector(".a-work-title");
const a_metaInfo = document.querySelector(".a-meta-info");
const a_imgCaption = document.querySelector(".a-img-caption");
const a_projectSection = document.querySelector(".a-project");
const a_image = document.querySelector(".a-image");
const a_imageOne = document.querySelector(".a-image-1");
const a_galleryScroll = document.querySelector(".a-gallery");

// Setting arrays for dynamic animations
const a_gallery = gsap.utils.toArray(".a-gallery");
const a_sections = gsap.utils.toArray(".a-project");
const a_imgCaptionsArr = gsap.utils.toArray(".a-image");


let a_maxWidth = 0;

const a_getMaxWidth = () => {
  a_maxWidth = 0;
  a_sections.forEach((a_section) => {
    a_maxWidth += a_section.offsetWidth;
  });
};
a_getMaxWidth();
ScrollTrigger.addEventListener("refreshInit", a_getMaxWidth);

let horizontalTween = gsap.to(a_sections, {
  x: () => `-${a_maxWidth - window.innerWidth / 1.5}`,
  ease: "none",
  scrollTrigger: {
    trigger: ".section--showcase",
    pin: true,
    scrub: true,
    end: () => `+=${a_maxWidth}`,
    invalidateOnRefresh: true
  }
});


aImages.forEach((image, i) => {
  console.log('banana')
  ScrollTrigger.create({
    trigger: image,
    containerAnimation: horizontalTween,
    start: 'left center',
    end: 'right center',
    markers: true,
    onToggle: (self) => {
      if(self.isActive) {
         console.log(self.trigger.dataset.caption)
      }
    }
  })
})
              
            
!
999px

Console