Pen Settings



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


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


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.


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.


                <div id="stage">
  <div id="targets">
    <div class="box box1">1</div>
    <div class="box box2">2</div>
    <div class="box box3">3</div>
    <div class="box box4">4</div>
    <div class="box box5">5</div>
<p>Scroll your mousewheel</p>


                body {
  background: #262626;
  display: flex;
  height: 100vh;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-direction: column;
  color: white;
  font-family: "Roboto", sans-serif;

.box {
  width: 100px;
  height: 100px;
  position: relative;
  margin-bottom: 2px;
  color: white;
  text-align: center;
  line-height: 100px;
  font-size: 24px;
  font-family: "Roboto", sans-serif;
  margin-right: 20px;
.box1 {
  background-color: #84c186;

.box2 {
  background-color: #8b6c4c;

.box3 {
  background-color: #39a3ee;

.box4 {
  background-color: #ef9144;

.box5 {
  background-color: #b84b4b;

#targets {
  position: absolute;
  display: flex;

#stage {
  width: 100px;
  height: 100px;
  border: dashed 1px white;
  padding: 10px;



                TweenLite.defaultEase = Power2.easeInOut;
var activeSlide = 0;
var oldSlide = 0;
var slides = document.querySelectorAll(".box");
var tl;

function slideAnim(e) {
  // if the container is animating the wheel won't work
  if (tl && tl.isActive()) {
  // temp variable to see if we're at the beginning or end
  oldSlide = activeSlide;
  // which way did we scroll the mousewheel
  activeSlide = e.deltaY > 0 ? (activeSlide += 1) : (activeSlide -= 1);
  // are we at the beginning of the slides?
  activeSlide = activeSlide < 0 ? 0 : activeSlide;
  // are we at the end of the slides?
  activeSlide = activeSlide > slides.length - 1 ? slides.length - 1 : activeSlide;
  // if at the beginning or end there is nothing to animate
  if (oldSlide === activeSlide) {
  // if not at the beginning or end, we can animate the container 
  // and the targets to the new position
  tl = new TimelineMax();".box", 0.25, { scale: 0.5 });"#targets", 0.4, { x: -120 * activeSlide });".box", 0.25, { scale: 1 });

// listen for mousewheel scroll
window.addEventListener("wheel", slideAnim);