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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                section
  .wrapper
    .slide
      .slide__upper-content
        .slide__logo-wrapper
          img(src="http://i67.tinypic.com/29c1l4g.png")

        .slide__claim-wrapper
          h1 Vedi quello che <br> gli altri non vedono
      .slide__bottom-content
        a(href="#" data-action="#close").slide__btn-cta Scopri di più

section
  .wrapper
    .slider
      .slider-item#slide-intro Slide intro
      .slider-item#slide-glasses-1 Slide 1       
      .slider-item#slide-glasses-2 Slide 2
      .slider-item#slide-glasses-3 Slide 3
      .slider-item Slide outro
      
    .slider-controls
      a#btn1(href="#slide-glasses-1") Slide1
      a#btn2(href="#slide-glasses-2") Slide2
      a#btn3(href="#slide-glasses-3") Slide3
    
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Roboto+Condensed');
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
.wrapper {
  position: absolute;
  width: 320px;
  height: 480px;
  top:0;
  left: 50%;
  margin-left: -160px;
  background: #1f1f1f;
  overflow: hidden;
}
.slider {
  position: relative;
  left: 0px;
  width: 1600px;
  height: 480px;
  overflow: hidden;
  background: rgba(255,255,255, .5);
}

.slider-item {
  position: relative;
  float: left;
  width: 320px;
  height: 100%;
  background: red;
}

.slider-controls {
  position: fixed;
  top: 480px;
  width: 320px;
  background: #e9e9e9;
}

.slider-controls a {
  display: inline-block;
  padding: 15px;
}

#slide-glasses-1 {
  background: red;
}

#slide-glasses-2 {
  background: green;
}

#slide-glasses-3 {
  background: blue;
}

#slide-intro {
  background: purple;
}
              
            
!

JS

              
                /**
 * ITEManimate object is used to animate ease with bezier functions
 * example: TweenMax.to($('selector'), 1.5, {left:"80%", ease: ITEManimate.bezier(0.04,0.86,0.8,1)});
 *
 * Used: https://github.com/rdallasgray/bez
 */
var ITEManimate = ({
    start: 0,
    bezier: function(p0, p1, p2, p3) {
        return ITEManimate.polyBez([p0, p1], [p2, p3]);

    },
    polyBez: function(p1, p2) {
        var A = [null, null],
            B = [null, null],
            C = [null, null],
            bezCoOrd = function(t, ax) {
                C[ax] = 3 * p1[ax], B[ax] = 3 * (p2[ax] - p1[ax]) - C[ax], A[ax] = 1 - C[ax] - B[ax];
                return t * (C[ax] + t * (B[ax] + t * A[ax]));
            },
            xDeriv = function(t) {
                return C[0] + t * (2 * B[0] + 3 * A[0] * t);
            },
            xForT = function(t) {
                var x = t,
                    i = 0,
                    z;
                while (++i < 14) {
                    z = bezCoOrd(x, 0) - t;
                    if (Math.abs(z) < 1e-3) break;
                    x -= z / xDeriv(x);
                }
                return x;
            };
        return function(t) {
            return bezCoOrd(xForT(t), 1);
        }
    }
});


//CUSTOM JS CODE
(function($) {
    'use strict';
    
    //ANIMATION
        
    var start = $('.slider');
  
    var main = {

        init: function() {
            var self = this;
            //GSAP ANIMATE
            main.animate();
        },

        //GSAP ANIMATION
        animate: function() {

            //OPEN
            function openAnimation() {
                TweenLite.to('.wrapper', 1, {
                  scrollTo: {
                      x: $("#slide-glasses-1").position().left
                  },
                  ease: Power2.easeOut,
                  delay: 1
              });
            }
          
            // QUI FUNZIONA          
            function goTo(target) {
              
                TweenLite.to('.wrapper', 1, {
                  scrollTo: {
                      x: $(target).position().left
                  },
                  ease: Power2.easeOut
              });
            }          
            
            // INTRO ANIMATION
            $(window).ready(function() {
              openAnimation();
            });        
            
            
          
            // TRIGGER
            $("*[href^='#']").click(function() {
              var target = $(this).attr('href');              
              //console.log(target);
              goTo(target);
              
              return false;
            });
          
        }
    };  
  
  
    $(window).resize(function() {});
    return main.init();
}($));




              
            
!
999px

Console