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

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

              
                <html>

<head>
  <link rel="stylesheet" href="index.css">
</head>

<body>
  
<header>
  <nav class="header">
    <h1>
      <span class="iconify" data-icon="logos-netflix" data-inline="false"></span> clone
    </h1>
  </nav>
  </header>
  
  <section clas="main">

    <section class="titles popularTitle">
      <h1 id="popularId">Popular On Netflix</h1>
    </section>
    <section class="slides1 popular slides">
    </section>
    <section class="titles trendTitle">
      <h1 id="trendingId">Trending Now</h1>
    </section>
    <section class="slides2 trending slides">
    </section>
    <section class="titles originalTitle">
      <h1 id="originalsId">Netflix Originals</h1>
    </section>
    <section class=" slides3 originals slides">
    </section>
  </section>
  <script src="index.pack.js"></script>
  <script src="https://code.iconify.design/1/1.0.7/iconify.min.js"></script>
</body>

</html>
              
            
!

CSS

              
                
@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Martel+Sans:[email protected]&display=swap");

body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Martel Sans", sans-serif;
  background: #1e2025;
  color: #e5e5e5;
  font-size: 16px;
  height:100%;
  
}

.main {
/*  position:relative; */
/*   display: flex;
  align-items:center; */
 
}

.left {
  top: 145px;
  bottom: 0;
  left: 0;
}

.right {
  top: 145px;
  bottom: 0;
  right: 0;
}

.left1 {
  top: 385px;
  bottom: 0;
  left: 0;
}

.right1 {
   top: 385px;
  bottom: 0;
  right: 0;
}

.left2 {
  top: 605px;
  bottom: 0;
  left: 0;
}

.right2 {
 
  top: 605px;
  bottom: 0;
  right: 0;
}

.arrow{
  position: absolute;
  color: #fff;
  opacity:0;
  text-decoration: none;
  font-size: 2.5em;
/*   width: 80px; */
  padding: 20px;
  text-align: center;
  z-index: 23;
  cursor: pointer;
}

/* .hide{
  
  display:none
} */

.arrow:hover {
opacity:1;
font-size: 2.5em;
}

.popular,
.trending,
.originals {
  padding-left: 50px;
  padding-top:20px;
  padding-bottom:20px;
  grid-gap: 10px;
/*   position:absolute; */
 
}

.popular:hover,.trending:hover, .originals:hover{
   position: absolute;


/*   position:relative; */
    z-index:200;
/*   border:10px solid red; */
/*     display: flex;
  justify-content: center;
  align-items: center; */
}

.popular {
  margin-top:60px;
  display: grid;
  grid-auto-flow: column;
  overflow-x: scroll;
  overflow-y: hidden;
  -ms-overflow-style: none; /* IE and Edge */
  scroll-behavior: smooth;
  align-items:flex-start;
}

/* 
.popular:after{
  
  content: '<';
  position: absolute;
  opacity: 1;  
  top: 180px;
  transition: 0.5s;
  color:white;
  font-size:50px;
} */ 
/* loop over this instead of arrows https://zzz.buzz/2016/06/16/working-with-pseudo-classes-in-javascript/ */

.trending {
 margin-top: 0;
  display: grid;
  grid-auto-flow: column;
  overflow-x: scroll;
  overflow-y: hidden;
  -ms-overflow-style: none; /* IE and Edge */
  scroll-behavior: smooth;
   align-items:flex-start;
}

::-webkit-scrollbar {
  width: 0px; /* Remove scrollbar space */
  background: transparent;
}

.originals {
 margin-top: 0;
  display: grid;
  grid-auto-flow: column;
  overflow-x: scroll;
  overflow-y: hidden;
  -ms-overflow-style: none; /* IE and Edge */
  scroll-behavior: smooth;
  align-items:flex-start;

}

.titles {
  padding-left: 50px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 16px;
  margin: 0;

}

.trendTitle,.originalTitle{
  position:relative;
  top:25px;
}



.popularTitle{
  position:relative;
  top:85px;
}


.header {
  margin: 0;
  font-family: "Bebas Neue", cursive;
  display: flex;
  justify-content: flex-start;
  gap: 50px;
  min-width: 100vw;
  align-items: center;
  height: 5vh;
  background: #151515;
  padding: 20px 20px;
  position: fixed;
  z-index: 12;
}

.imagewrapper {
  background:#1E2025;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
  width: 220px;
  transition-duration: 0.5s;
  overflow: hidden;
  cursor: pointer;

}

.rating {
  color: #a0afbf;
}

.noOfReviews {
  font-size: 10px;
  color: rgb(160, 175, 191);
}



.hide {
  display: none;
}

p {
    font-size: 12px;
    text-align: center;
}

.imagewrapper:hover .hide{
  display: grid;
  grid-template-columns: 50px 50px;
  justify-content: center;
  align-items: center;
  margin: 34px;
}

img {
  width: 220px;
  height: 112px;
  border-radius: 5px;
}

.images {
  display: flex;
  justify-content: center;
  width: 261px;
  height: 112px;
  position:relative;
  z-index:3;
}
.imagewrapper:hover {
  display: flex;
  flex-direction: column;
  transform: scale(1.1);
  transition: transform 0.5s; 
  cursor: pointer;
  box-shadow: 5px 2px 10px rgba(0, 0, 0.3, 0.3);

}




.thumbsup input {
  display: none;
}

.thumbsup span:after {
  width: 20px;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  content: "👍";
  filter: grayscale(100%);
  font-size: 1.2rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.thumbsup:hover {
  animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

.thumbsdown:hover {
  animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

@keyframes shake {
  10%,
  70% {
    transform: translate3d(-1px, 0, 0);
  }

  20%,
  30% {
    transform: translate3d(2px, 0, 0);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

 .thumbsup:checked + span:after {
  content: "👍";
  filter: grayscale(100%);
}

.thumbsup input:checked + span:after {
  font-size: 1.2rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid grey;
  border-radius: 50%;
  background: black;
  transition: 0.1s all;
  cursor: pointer;
  z-index: 999;
}

.thumbsup input:checked + span:after {
  font-size: 1.2rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid grey;
  border-radius: 50%;
  background: black;
  transition: 0.1s all;
  cursor: pointer;
  z-index: 999;
}
.thumbsdown input {
  display: none;
}

.thumbsdown span:after {
  width: 20px;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  content: "👎";
  filter: grayscale(100%);
  font-size: 1.2rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.thumbsdown:checked + span:after {
  content: "👎";
  filter: grayscale(100%);
}

.thumbsdown input:checked + span:after {
  font-size: 1.2rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid grey;
  border-radius: 50%;
  background: black;
  transition: 0.1s all;
  cursor: pointer;
  z-index: 999;
}

@media only screen 
  and (min-device-width: 320px) 
  and (max-device-width: 480px)
  and (-webkit-min-device-pixel-ratio: 2) {
    .arrow{
      display:none;
    }
}

@media only screen 
  and (min-device-width: 320px) 
  and (max-device-width: 568px)
  and (-webkit-min-device-pixel-ratio: 2) {
 .arrow{
      display:none;
    }
}

@media only screen 
  and (min-device-width: 375px) 
  and (max-device-width: 667px) 
  and (-webkit-min-device-pixel-ratio: 2) { 
 .arrow{
      display:none;
    }
}

@media only screen 
  and (min-device-width: 414px) 
  and (max-device-width: 736px) 
  and (-webkit-min-device-pixel-ratio: 3) { 
.arrow{
      display:none;
    }
}

@media only screen 
  and (min-device-width: 375px) 
  and (max-device-width: 812px) 
  and (-webkit-min-device-pixel-ratio: 3) { 
    
    .arrow{
      display:none;
    }

}

@media only screen 
    and (device-width: 390px) 
    and (device-height: 844px) 
    and (-webkit-device-pixel-ratio: 3) { 
      .arrow{
        display:none;
      }
      body{
        margin-bottom:120px;
      }
}
              
            
!

JS

              
                const films = [
  {
    title: "Bridgerton",
    url: "https://assets.codepen.io/3383494/bridgerton.jpg",
    rating: 4,
    reviewno: 768,
    category: "popular",
    Type: "series"
  },
  {
    title: "Fate",
    url: "https://assets.codepen.io/3383494/fate.jpg",
    rating: 3,
    reviewno: 78,
    category: "popular",
    Type: "series"
  },
  {
    title: "Lupin",
    url: "https://assets.codepen.io/3383494/lupin.jpg",
    reviewno: 1021,
    rating: 4,
    category: "popular"
  },
  {
    title: "Night Stalker",
    url: "https://assets.codepen.io/3383494/nightstalker.jpg",
    rating: 4,
    category: "popular"
  },
  {
    title: "Star Trek",
    url: "https://assets.codepen.io/3383494/startrek.jpg",
    rating: 5,
    category: "popular"
  },
  {
    title: "The Crown",
    url: "https://assets.codepen.io/3383494/thecrown.jpg",
    rating: 5,
    category: "popular"
  },
  {
    title: "The Last Kingdom",
    url: "https://assets.codepen.io/3383494/thelastkingdom.jpg",
    rating: 4,
    category: "popular"
  },
  {
    title: "The Crown",
    url: "https://assets.codepen.io/3383494/thecrown.jpg",
    rating: 5,
    category: "popular"
  },
  {
    title: "American Horror Story",
    url: "https://assets.codepen.io/3383494/americanhorrorstory.webp",
    rating: 5,
    category: "popular"
  },
  {
    title: "Stranger Things",
    url: "https://assets.codepen.io/3383494/strangerthings.jpg",
    rating: 5,
    category: "popular"
  },
  {
    title: "Bridgerton",
    url: "https://assets.codepen.io/3383494/bridgerton.jpg",
    rating: 4,
    category: "popular"
  },
  {
    title: "Marcella",
    url: "https://assets.codepen.io/3383494/marcella.webp",
    rating: 3,
    category: "popular"
  },
  {
    title: "Surviving Death",
    url: "https://assets.codepen.io/3383494/survivingdeath.jpg",
    rating: 3,
    category: "trending"
  },
  {
    title: "Stranger Things",
    url: "https://assets.codepen.io/3383494/strangerthings.jpg",
    rating: 5,
    category: "trending"
  },
  {
    title: "Marcella",
    url: "https://assets.codepen.io/3383494/marcella.webp",
    rating: 3,
    category: "trending"
  },
  {
    title: "Breaking Bad",
    url: "https://assets.codepen.io/3383494/breakingbad.webp",
    rating: 5,
    category: "trending"
  },
  {
    title: "The Last Kingdom",
    url: "https://assets.codepen.io/3383494/thelastkingdom.jpg",
    rating: 4,
    category: "trending"
  },
  {
    title: "Star Trek",
    url: "https://assets.codepen.io/3383494/startrek.jpg",
    rating: 5,
    category: "trending"
  },
  {
    title: "Bridgerton",
    url: "https://assets.codepen.io/3383494/bridgerton.jpg",
    rating: 4,
    category: "trending",
    Type: "series"
  },
  {
    title: "Fate",
    url: "https://assets.codepen.io/3383494/fate.jpg",
    rating: 3,
    category: "trending"
  },
  {
    title: "Lupin",
    url: "https://assets.codepen.io/3383494/lupin.jpg",
    rating: 4,
    category: "trending"
  },
  {
    title: "American Horror Story",
    url: "https://assets.codepen.io/3383494/americanhorrorstory.webp",
    rating: 5,
    category: "trending"
  },
  {
    title: "Night Stalker",
    url: "https://assets.codepen.io/3383494/nightstalker.jpg",
    rating: 4,
    category: "trending"
  },
  {
    title: "Star Trek",
    url: "https://assets.codepen.io/3383494/startrek.jpg",
    rating: 5,
    category: "trending"
  },
  {
    title: "The Last Kingdom",
    url: "https://assets.codepen.io/3383494/thelastkingdom.jpg",
    rating: 4,
    category: "originals"
  },
  {
    title: "The Crown",
    url: "https://assets.codepen.io/3383494/thecrown.jpg",
    rating: 5,
    category: "originals"
  },
  {
    title: "American Horror Story",
    url: "https://assets.codepen.io/3383494/americanhorrorstory.webp",
    rating: 5,
    category: "originals"
  },
  {
    title: "Stranger Things",
    url: "https://assets.codepen.io/3383494/strangerthings.jpg",
    rating: 5,
    category: "originals"
  },
  {
    title: "Bridgerton",
    url: "https://assets.codepen.io/3383494/bridgerton.jpg",
    rating: 4,
    category: "originals"
  },
  {
    title: "Marcella",
    url: "https://assets.codepen.io/3383494/marcella.webp",
    rating: 3,
    category: "originals"
  },
  {
    title: "Surviving Death",
    url: "https://assets.codepen.io/3383494/survivingdeath.jpg",
    rating: 3,
    category: "originals"
  },
  {
    title: "Bridgerton",
    url: "https://assets.codepen.io/3383494/bridgerton.jpg",
    rating: 4,
    category: "originals"
  },
  {
    title: "Fate",
    url: "https://assets.codepen.io/3383494/fate.jpg",
    rating: 3,
    category: "originals"
  },
  {
    title: "Lupin",
    url: "https://assets.codepen.io/3383494/lupin.jpg",
    rating: 4,
    category: "originals"
  },
  {
    title: "Night Stalker",
    url: "https://assets.codepen.io/3383494/nightstalker.jpg",
    rating: 3,
    category: "originals"
  },
  {
    title: "Star Trek",
    url: "https://assets.codepen.io/3383494/startrek.jpg",
    rating: 4,
    category: "originals"
  },
  {
    title: "The Crown",
    url: "https://assets.codepen.io/3383494/thecrown.jpg",
    rating: 4,
    category: "originals"
  }
];

let popular = "";
let trending = "";
let originals = "";

// console.log(films)
const $ = (ele) => document.querySelector(ele);
const $$ = (ele) => document.querySelectorAll(ele);

function getFilms(element, filmElement, rightArrow, leftArrow, displayFilms) {
  films.forEach((film, index) => {
    const { title, url, rating, category, reviewno } = film;

    category === filmElement
      ? (element += `
     
    <section class='imagewrapper popularimg'>
    <div class="images">
        <img class="img-${index}" src="${url}">
    </div>
    <div class="hide">
        <label class="thumbsup">
            <input type="checkbox"/>
            <span></span>
        </label>
        <label class="thumbsdown">
            <input type="checkbox"/>
            <span></span>
        </label>
    <p>Rating:</p>
    <p>${"*".repeat(rating)}</p>			
    </section>
        
      `)
      : "Error: cannot load films";
  });

  displayFilms.innerHTML = leftArrow + element + rightArrow; // could use${index}to get leftArrow1/2/3 etc
  
  //image index.lenght to get padding
}

let popularFilms = getFilms(
  popular,
  "popular",
  `<div class="arrow right next">></div>`,
  `<div class="arrow left previous"><</div>`,
  $(".popular")
);


let trendingFilms = getFilms(
  trending,
  "trending",
  `<div class="arrow right1 next">></div>`,
  `<div class="arrow left1 previous"><</div>`,
  $(".trending")
);

let originalFilms = getFilms(
  originals,
  "originals",
  `<div class="arrow right2 next">></div>`,
  `<div class="arrow left2 previous"><</div>`,
  $(".originals")
);

//****slider functionality*******
let scrollCount = 0;

let slidesScrollWidth =  $(".originals").clientWidth;

let scrollClick = $(".img-1").clientWidth + slidesScrollWidth;

function scrollLeft(event) {
  if (event.target === this) {
     
    
    this.parentNode.scrollTo({
      left: (scrollCount -= scrollClick),
      behaviour: "smooth"
    });
    
  }
  if (scrollCount < 0) {
    scrollCount = 0;
  }
  
}

let slideArray = Array.from($$(".slides"));

function scrollRight(event) {
  if (
    event.target === this &&
    scrollCount <= this.parentNode.scrollWidth - this.parentNode.clientWidth
  ) {
    this.parentNode.scrollTo({
      left: (scrollCount += scrollClick),
      behaviour: "smooth"
    });
     scrollCount = 0;
  }
 
}

function thumbsUpDown() {
  if (this.checked) {
    $$("input").forEach((item) => (item.checked = false));
    this.checked = true;
  }
}

$$("input").forEach((item) => item.addEventListener("click", thumbsUpDown));
$$(".next").forEach((next) => next.addEventListener("click", scrollRight));
$$(".previous").forEach((previous) =>
  previous.addEventListener("click", scrollLeft)
);


              
            
!
999px

Console