Lista de episodios y temporadas

El Contexto
0

Lista de episodios y temporadas para Series y Anime

En esta ocación les traigo un pequeño codigo muy sencillo para desarrollar una lista de temporadas y episodios con un search para nuestra pagina web de Series y Animes

Instalar

Lo primero que haremos es instalar los estilos para TEMPORADAS y EPISODIOS


  /* Estilos para lista de TEMPORADAS */

/* Style the tab */
.tab {
    float: left;
    border: 1px solid #ccc;
    background-color: #f1f1f1;
    width: 20%;
    height: 500px;
    border-radius: 5px;
}
  
/* Style the buttons inside the tab */
.tab button {
    display: flex;
    /* background-color: inherit; */
    color: black;
    padding: 8px;
    width: 100%;
    border: none;
    outline: none;
    text-align: left;
    cursor: pointer;
    transition: 0.3s;
    font-size: 14px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
  
/* Change background color of buttons on hover */
.tab button:hover {
  background-color: #ddd;
}

/* Create an active/current "tab button" class */
.tab button.active {
  background-color: #ccc;
}

/* Style the tab content */
.tabcontent {
    float: left;
    padding: 10px;
    border: 1px solid #ccc; 
    width: 80%;
    border-left: none;
    height: 500px;
    overflow: auto;
}
  
  season_footer {
    font-size: 12px;
}
  
    @media only screen and (max-width: 425px) {
 .tab {
    width: 37%;
}
    
 .tabcontent {
    width: 63%;
}
      
       #myUL {
    font-size: 14px;
}
}

.epilist {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    margin: 10px 0;
}
  
/* Estilos para lista de EPISODIOS */
#myInput {
  width: 100%;
  font-size: 16px;
  padding: 10px;
  border: 1px solid #ddd;
  margin-bottom: 12px;
}

#myUL {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

#myUL li {
    list-style-type: none;
}
  
#myUL li a {
  border: 1px solid #ddd;
  margin-top: -1px; /* Prevent double borders */
  background-color: #f6f6f6;
  padding: 12px;
  text-decoration: none;
  /* font-size: 18px; */
  color: black;
  display: block
}

#myUL li a:hover:not(.header) {
  background-color: #eee;
}

Despues de haber instalado los estilos, procedemos a instalar el script justo arriba del cierre de </body>


// script para lista de episodios

function openCity(evt, cityName) {
  var i, tabcontent, tablinks;
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }
  tablinks = document.getElementsByClassName("tablinks");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }
  document.getElementById(cityName).style.display = "block";
  evt.currentTarget.className += " active";
}

// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();


Y por ultimo, agregaremos este script por encima del cierre de </body>


  // script para lista de episodios
  
function myFunction() {
    var input, filter, ul, li, a, i, txtValue;
    input = document.getElementById("myInput");
    filter = input.value.toUpperCase();
    ul = document.getElementById("myUL");
    li = ul.getElementsByTagName("li");
    for (i = 0; i < li.length; i++) {
        a = li[i].getElementsByTagName("a")[0];
        txtValue = a.textContent || a.innerText;
        if (txtValue.toUpperCase().indexOf(filter) > -1) {
            li[i].style.display = "";
        } else {
            li[i].style.display = "none";
        }
    }
}

Publicar un comentario

0 Comentarios
Publicar un comentario (0)
Our website uses cookies to enhance your experience. Learn More
Accept !
WhatsApp Icon
Messenger Icon