css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <nav>
  <ul>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <div class="badboy"></div>
  </ul>
</nav>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
            
          
!
            
              // **********************import
@import "bourbon";

// **********************reset
* {
    @include box-sizing(border-box);

    padding: 0;
    margin: 0;
}
// **********************home
body {
    background-color: #333344;
    width: 6600px;
    height: 95vh;
    overflow-Y: hidden;
    position: relative;

    &::-webkit-scrollbar-track {
        -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
        border-radius: 10px;
        background-color: #aa1;
    }

    &::-webkit-scrollbar {
        width: 20px;
        background-color: #aa1;
        border-radius: 10px;
    }

    &::-webkit-scrollbar-thumb {
        border-radius: 10px;
        -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
        background-color: yellow;
    }
}

nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    max-width: 100%;
}

ul {
    list-style-type: none;

    @include perspective(2500);
}

li {
    cursor: pointer;
    opacity: 0;
    max-width: 100%;
    float: left;
    width: 602px;
    height: 339px;

    // @for $i from 1 through 10 {
    //     &:nth-child(#{$i}) {
    //         background: url("../img/#{$i}.jpg");
    //     }
    // }
  &:nth-child(1) {
  background: url("http://www.zastavki.com/pictures/originals/2014/Men___Male_Celebrity_Famous_Hollywood_Movie_star_Ian_Somerhalder_056870_.jpg")  no-repeat center;
    background-size:450px 300px;
}

&:nth-child(2) {
  background: url("https://images.moviepilot.com/images/c_limit,q_auto,w_710/tcwbhvhdtnbbqfsudkpk/cbs-taps-x-men-actor-to-star-in-new-macgyver-drama-series.jpg") no-repeat center;
  background-size:450px 300px;
}

&:nth-child(3) {
  background: url("https://wallpaperscraft.com/image/tom_hiddleston_jaguar_car_man_style_96849_602x339.jpg") no-repeat center;
  background-size:450px 300px;
}

&:nth-child(4) {
  background: url("https://wallpaperscraft.com/image/kit_harington_the_observer_2015_photoshoot_102283_602x339.jpg") no-repeat center;
  background-size:450px 300px;
}

&:nth-child(5) {
  background: url("https://wallpaperscraft.com/image/ian_somerhalder_actor_celebrity_brunette_96784_602x339.jpg") no-repeat center;
  background-size:450px 300px;
}

&:nth-child(6) {
  background: url("https://wallpaperscraft.com/image/tom_cruise_actor_celebrity_man_brunette_7205_602x339.jpg") no-repeat center;
  background-size:450px 300px;
}

&:nth-child(7) {
  background: url("https://wallpaperscraft.com/image/johnny_depp_actor_person_cigarette_91827_602x339.jpg") no-repeat center;
  background-size:450px 300px;
}

&:nth-child(8) {
  background: url("https://wallpaperscraft.com/image/daniel_craig_actor_person_man_jacket_96837_602x339.jpg") no-repeat center;
  background-size:450px 300px;
}

&:nth-child(9) {
  background: url("https://wallpaperscraft.com/image/aaron_paul_auto_actor_celebrity_82485_602x339.jpg") no-repeat center;
  background-size:450px 300px;
}

&:nth-child(10) {
  background: url("https://wallpaperscraft.com/image/luke_evans_actor_costume_style_bw_103390_602x339.jpg") no-repeat center;
  background-size:450px 300px;
}

    &:hover {
        box-shadow: 0 5px 0 0 white;
    }

    @include animation(onload-animation 1s);

    @include animation-fill-mode(forwards);
}

.badboy {
    clear: both;
}

// **********************Media query
@media screen and (max-width: 800px) {
    body {
        width: 95vw;
        height: 3950px;
        overflow-X: hidden;
        overflow-Y: auto;
    }

    nav {
        top: 0;
        transform: translateX(0);
    }

    li {
        margin-left: 50%;

        @include transform(translateX(-50%));

        margin-top: 50px;

        @include animation(onload-animation2 1s);

        @include animation-fill-mode(forwards);
    }
}

@media screen and (min-width: 801px) {
    li {
        margin-left: 50px;
    }
}
// **********************Keyframes
@include keyframes(onload-animation) {
    0% {
        @include transform(scale(0.5));

        opacity: 0;
    }

    50% {
        @include transform(scale(1.1));

        opacity: 0.5;
    }

    100% {
        @include transform(scale(1));

        opacity: 1;
    }
}


@include keyframes(onload-animation2) {
    0% {
        @include transform(translateX(-50%) scale(0.5));

        opacity: 0;
    }

    50% {
        @include transform(translateX(-50%) scale(1.1));

        opacity: 0.5;
    }

    100% {
        @include transform(translateX(-50%) scale(1));

        opacity: 1;
    }
}
            
          
!
            
              $(document).ready(function() {
  var $animation_elements = $('li');
  var $window = $(window);
  $window.on('scroll', check_if_in_view);
  $window.on('scroll resize', check_if_in_view);
  // $window.trigger('scroll');

  function check_if_in_view() {
    if ($window.width() > 800) {
      var window_width = $window.width();
      var window_left_position = $window.scrollLeft();
      var window_right_position = (window_left_position + window_width);

      $.each($animation_elements, function() {
        var $element = $(this);
        var element_width = $element.outerWidth();
        var element_left_position = $element.offset().left;
        var element_right_position = (element_left_position + element_width);

        //check to see if this current container is within viewport
        if ((element_right_position >= window_left_position) &&
          (element_left_position <= window_right_position)) {
          $element.removeClass('flipInX').addClass('fadeIn');
        } else {
          $element.removeClass('fadeIn');
        }
      });
    } else {

      var window_height = $window.height();
      var window_top_position = $window.scrollTop();
      var window_bottom_position = (window_top_position + window_height);

      $.each($animation_elements, function() {
        var $element = $(this);
        var element_height = $element.outerHeight();
        var element_top_position = $element.offset().top;
        var element_bottom_position = (element_top_position + element_height);

        //check to see if this current container is within viewport
        if ((element_bottom_position >= window_top_position) &&
          (element_top_position <= window_bottom_position)) {
          $element.removeClass('flipInX').addClass('fadeIn');
        } else {
          $element.removeClass('fadeIn');
        }
      });
    }
  }

  // Scroll body by mouse position
  var requestAnimationFrame = window.requestAnimationFrame ||
    window.webkitRequestAnimationFrame ||
    window.mozRequestAnimationFrame ||
    window.oRequestAnimationFrame ||
    window.msRequestAnimationFrame;

  var $elems = $("html, body");
  var delta = 0;
  myfunc();
  $(window).on('resize', function() {
    myfunc();
  });

  function myfunc() {
    if ($(window).width() > 800) {
      horizontalScroll();
    } else {
      verticalScroll();
    }

  }

  function horizontalScroll() {

    $(document).on("mousemove", function(e) {
      var w = $(window).width();
      var y = e.clientX - w / 2;
      delta = y * 0.1;
    });

    $(window).on("blur mouseleave", function() {
      delta = 0;
    });

    (function f() {
      if (delta) {
        $elems.scrollLeft(function(i, v) {
          return v + delta;
        });
      }
      // webkitRequestAnimationFrame(f);
      requestAnimationFrame(f);
    })();
  }

  function verticalScroll() {

    $(document).on("mousemove", function(e) {
      var h = $(window).height();
      var y = e.clientY - h / 2;
      delta = y * 0.1;
    });

    $(window).on("blur mouseleave", function() {
      delta = 0;
    });

    (function f() {
      if (delta) {
        $elems.scrollTop(function(i, v) {
          return v + delta;
        });
      }
      // webkitRequestAnimationFrame(f);
      requestAnimationFrame(f);
    })();

  }

});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console