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

              
                <body>
<div class="scrollContainer">
<div id="boiteprincipale">
	<div class="cols" id="col1">
		#
	</div>
	<div class="cols" id="col2">
	</div>
	<div class="cols" id="col3">
		5
	</div>
	<div class="cols" id="col4">
	best
	</div>
	<div class="cols" id="col5">
		<div id="col5-1">404</div>
		<div id="col5-2">errors</div>
	</div>
	<div class="cols" id="col6">
	</div>
	<div class="cols" id="col7">
	#
	</div>

</div>


<div id="container">
    <section>
        <div class="box box1"></div>
		<div class="box">
        <h1>www.stackoverflow.com</h1>
		<div class="text">
		Stack Overflow is a question and answer site for professional and enthusiast programmers. It is a privately held website, the flagship site of the Stack Exchange Network, created in 2008 by Jeff Atwood and Joel Spolsky. It features questions and answers on a wide range of topics in computer programming. It was created to be a more open alternative to earlier question and answer sites such as Experts-Exchange.</div>
		<a href="https://stackoverflow.com/quesfdons/21404277/how-to-get-value-using-getelementbyid-for-id-as-array" target="_blank">[link]</a>
		</div>
    </section>
    
    <section>
        <div class="box box2"></div>
		<div class="box">
		<h1>www.aa.com</h1>
        <div class="text">
		American Airlines, Inc. (AA) is a major American airline headquartered in Fort Worth, Texas, within the Dallas-Fort Worth metroplex. It is the world's largest airline when measured by fleet size, scheduled passengers carried, and revenue passenger mile. American, together with its regional partners, operates an extensive international and domestic network with almost 6,800 flights per day to nearly 350 destinations.</div>
 		<a href="https://www.aa.com/404" target="_blank">[link]</a>
		</div>
   </section>
	 
    <section>
        <div class="box box3"></div>
		<div class="box">
		<h1>www.the-artery.com</h1>
        <div class="text">
		The-Artery is a full-service creative studio that specializes in creating content for features films, episodic, and consumer brands across all platforms. They put design at the center of their creativity, both aesthetically and functionally. They set the creative bar very high and then hire pole-vaulters. Passionate people. People who look for the incredible satisfaction that comes from doing something extraordinary.</div>
		<a href="https://www.the-artery.com/404" target="_blank">[link]</a>
		</div>
    </section>
    
    <section>
        <div class="box box4"></div>
		<div class="box">
		<h1>www.astuteo.com</h1>
		<div class="text">
		Astuteo is a web design, digital marketing firm located in Madison, Wisconsin. They specialize in helping Wisconsin manufacturers use data, design and a relentless work ethic to connect with more digital customers. Their expertise, combined with insight into your target audience, products and sales process, allows them to drive initiatives that turn your website, marketing channels into lead generation machines.</div>
		<a href="https://www.astuteo.com/404/" target="_blank">[link]</a>
		</div>
    </section>
	
	<section>
        <div class="box box5"></div>
		<div class="box">
		<h1>www.marvel.com</h1>
        <div class="text">
		The Marvel Cinematic Universe (MCU) is an American media franchise and shared universe centered on a series of superhero films, independently produced by Marvel Studios and based on characters that appear in American comic books published by Marvel Comics. The franchise includes comic books, short films, television series, and digital series. The first MCU film is Iron Man (2008).  </div>
		<a href="https://www.marvel.com/404" target="_blank">[link]</a>
		</div>
    </section>
</div>
</div>
              
            
!

CSS

              
                * {
	margin:0;
	padding:0;
	}
body {
	overflow-x:hidden;
	background:#f4edde;
}	
a {
  display: inline-block;
  text-decoration: none;
  background: #dd0000;
  color: #fff;
  font-size:20px;
  padding: 10px 20px;
  
}
a:hover {
	text-decoration:none;
}

@font-face {
  font-family: "Stab";
  src: url("http://404page.free.fr/fonts/Stab.ttf");
}
/*css anim header*/
#boiteprincipale {
	width:880px;
	height:262px;
	margin:auto;
	font-family: "Stab";
	color:#094370;
}
#col1 {
	width:130px;
	height:242px;
	font-size:150px;
	text-align:left;
	line-height:262px;
	padding-top:20px
	}
#col2 {
	height:262px;
	border-right: 5px dashed #094370;
	margin-right:10px;
	}
#col3 {
	width:167px;
	height:216px;
	font-size:340px;
	line-height:262px;
	padding-top:46px;
	margin-right:-20px;
	}
#col4 {
	margin-top:20px;
	transform: rotate(-90deg);
	transform-origin: bottom;
	height:112px;
	font-size:120px;
}
#col5 {
	margin-left:-130px;
	color:#dd0000;
}
#col5-1 {
	color:#dd0000;
	font-size:220px;
	margin-bottom:-65px;
}
#col5-2 {
	font-size:95px;
}
#col6 {
	height:262px;
	border-right: 5px dashed #094370;
	margin-left:10px;
}
#col7 {
	 width:110px;
	 margin-left:20px;
	 font-size:150px;
	 line-height:262px;
	 padding-top:20px;

}
.cols {
	float: left;
}


/*css affichage*/
#container {
    max-width: 1010px;
    margin: auto;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color:#094370;
}
h1 {
	font-size: 25px;
	margin-bottom:11px;
}
/* Clearfix */
section::after {
    content: '';
    clear: both;
    display: block;
}

.box {
	display:block;
    width: 500px;
	margin-left:5px;
    height: 400px;
    float: left;
    font-size: 25px;
    will-change: transform, opacity;
}
.box1 {
    background-image: url("http://404page.free.fr/images/stackoverflow.jpg");
	height:315px;
}
.box2 {
    background-image: url("http://404page.free.fr/images/aa.jpg");
	height:315px;
}
.box3 {
    background-image: url("http://404page.free.fr/images/the-artery.jpg");
	height:315px;
}
.box4 {
    background-image: url("http://404page.free.fr/images/astuteo.jpg");
	height:315px;
}
.box5 {
    background-image: url("http://404page.free.fr/images/marvel.jpg");
	height:315px;
}
.text {
	font-size:20px;
	line-height:128%;
}

/* styling just for demo */
section { margin: 20vh 0; }


              
            
!

JS

              
                //smooth scrolling
const locoScroll = new LocomotiveScroll({
  el: document.querySelector(".scrollContainer"),
  smooth: true
}); 
// each time Locomotive Scroll updates, tell ScrollTrigger to update too (sync positioning)
       locoScroll.on("scroll", ScrollTrigger.update);
// tell ScrollTrigger to use these proxy methods for the ".smooth-scroll" element since Locomotive Scroll is hijacking things
    ScrollTrigger.scrollerProxy(".scrollContainer", {
      	scrollTop(value) {
    			return arguments.length ? locoScroll.scrollTo(value, 0, 0) : locoScroll.scroll.instance.scroll.y;
  }, // we don't have to define a scrollLeft because we're only scrolling vertically.
  getBoundingClientRect() {
    return {top: 0, left: 0, width: window.innerWidth, height: window.innerHeight};
  },
  // LocomotiveScroll handles things completely differently on mobile devices - it doesn't even transform the container at all! So to get the correct behavior and avoid jitters, we should pin things with position: fixed on mobile. We sense it by checking to see if there's a transform applied to the container (the LocomotiveScroll-controlled element).
  pinType: document.querySelector(".scrollContainer").style.transform ? "transform" : "fixed"
});

//header
gsap.set("#col7", {scaleX:-1});
gsap.timeline()
  .from("#col2, #col6", {scale:0, ease:"back" })
	           .from("#col1, #col7", {opacity:0, scale:0, ease:"back"},1)
			   .from("#col3", {y:-300, opacity:0, ease:"back"}) 
			   .from("#col4", {y:300, opacity:0, ease:"back"}) 
				/*blink*/
			   .from("#col5-1", {opacity:0, duration:0.10, ease:"back", repeat: 2, yoyo:true}) 
			   .from("#col5-2", {opacity:0, y:-200, ease:"back"});
			  			   




//navigation
gsap.utils.toArray("section").forEach(section => {
    const boxes = section.querySelectorAll(".box");
	const titles = section.querySelectorAll("h1");
	const texts = section.querySelectorAll(".text");
	const links = section.querySelectorAll("a");

    const tl = gsap.timeline({
        scrollTrigger: {
            trigger: section,
            start: "top bottom",
            end: "bottom top",
            markers: false,
            toggleActions: "play none none reverse"
        },
        defaults: {
            //duration: 1,
            opacity: 0,
            ease: "power2"
        }
    })
    //.from(boxes[0], { x: "-100vw", filter: "blur(8px)", })
    //.from(titles[0], { x: 40, opacity: 0 }, 1)
    //.from(texts[0], { y: 20, opacity: 0}, 1.5)
    //.from(links[0], { x: 40}, 2)
    
    .from(boxes[0], { duration: 0.25, x: "-100vw", filter: "blur(8px)", })
    .from(titles[0], { duration: 0.25, x: 40, opacity: 0 })
    .from(texts[0], { duration: 0.25, y: 20, opacity: 0})
    .from(links[0], { duration: 0.25, x: 40})
    
});

// each time the window updates, we should refresh ScrollTrigger and then update LocomotiveScroll. 
ScrollTrigger.addEventListener("refresh", () => locoScroll.update());

// after everything is set up, refresh() ScrollTrigger and update LocomotiveScroll because padding may have been added for pinning, etc.
ScrollTrigger.refresh();


//links
var hoverMouse = function ($el) {
  $el.each(function () {
    var $self = $(this);
    var hover = false;
    var offsetHoverMax = $self.attr("offset-hover-max") || 0.7;
    var offsetHoverMin = $self.attr("offset-hover-min") || 0.5;

    var attachEventsListener = function () {
      $(window).on("mousemove", function (e) {
        //
        var hoverArea = hover ? offsetHoverMax : offsetHoverMin;

        // cursor
        var cursor = {
          x: e.clientX,
          y: e.clientY + $(window).scrollTop() };


        // size
        var width = $self.outerWidth();
        var height = $self.outerHeight();

        // position
        var offset = $self.offset();
        var elPos = {
          x: offset.left + width / 2,
          y: offset.top + height / 2 };


        // comparaison
        var x = cursor.x - elPos.x;
        var y = cursor.y - elPos.y;

        // dist
        var dist = Math.sqrt(x * x + y * y);

        // mutex hover
        var mutHover = false;

        // anim
        if (dist < width * hoverArea) {
          mutHover = true;
          if (!hover) {
            hover = true;
          }
          onHover(x, y);
        }

        // reset
        if (!mutHover && hover) {
          onLeave();
          hover = false;
        }
      });
    };

    var onHover = function (x, y) {
      gsap.to($self, 0.4, {
        x: x * 0.8,
        y: y * 0.8,
        //scale: .9,
        rotation: x * 0.05,
        ease: Power2.easeOut });

    };
    var onLeave = function () {
      gsap.to($self, 0.7, {
        x: 0,
        y: 0,
        scale: 1,
        rotation: 0,
        ease: Elastic.easeOut.config(1.2, 0.4) });

    };

    attachEventsListener();
  });
};

hoverMouse($('a'));

//tilt 3d
// c'est trop chaud !
function mouseMove(e) {
  var xPos = event.clientX / $(window).width() - 0.5,
  yPos = event.clientY / $(window).height() - 0.5,
  //box = $('.box'),
  box = e.target;
  coord = $('.coordinates');

  gsap.to(box, 0.6, {
    rotationY: 25 * xPos, /* 5 px */
    rotationX: 25 * yPos, /* 5 px */
    ease: Power1.easeOut,
    transformPerspective: 900, /* 900 */
    transformOrigin: 'center' });


}

$('.box').on('mouseenter', function () {
  $('.box').on('mousemove', mouseMove);
});


$('.box').on('mouseleave', function () {
  $('.box').off('mousemove', mouseMove);
  gsap.to('.box', 0.3, { delay: 0.3, rotationY: 0, rotationX: 0, ease: Power1.easeOut });
});


              
            
!
999px

Console