Mostrando entradas con la etiqueta css. Mostrar todas las entradas
Mostrando entradas con la etiqueta css. Mostrar todas las entradas

febrero 27, 2023

Reproductor con HTML CSS jQuery JS

Reproductor de audio sencillo utilizando HTML, CSS, jQuery, con lista de reproducción, iconos insertados a través de Font awesome a continuación una lista detallada del reproductor:

  • Opción de descarga de audio.
  • Responsive.
  • Lista de reproducción.
  • Buscador.

  • Instalar

    Primeramente debemos Insertar el código abajo de la etiqueta <head>

    
        <link rel="stylesheet" href="https://cdn.plyr.io/3.6.12/plyr.css" />
        <script
          src="https://kit.fontawesome.com/cf0160c90b.js"
          crossorigin="anonymous"
        ></script>
        <script
          src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"
          type="text/javascript"
        ></script>
        <link rel="stylesheet" href="index.css" />
    

    Insertar el código abajo de la etiqueta <body>

    
     <section id="containerPlay">
          <div id="containerAll"></div>
          <input type="checkbox" id="list" />
    
          <div id="imgCover">
            <img
              src="https://emtodolugarnet.files.wordpress.com/2020/12/whatsapp-image-2020-12-17-at-11.04.55.jpeg?w=1024"
            />
          </div>
          <div id="information">
            <h1>RBD</h1>
            <h2>Lista de canciones RBD</h2>
          </div>
          <div id="bodyPlay">
            <audio class="js-player">
              <source
                src="https://docs.google.com/uc?export=download&id=1OGlxb_w5Gq_DFQ_28STBBMPUfOpuzWyx"
                type="audio/mp3"
              />
            </audio>
            <button id="backward">
              <i class="fa fa-backward" aria-hidden="true"></i>
            </button>
            <button id="forward">
              <i class="fa fa-forward" aria-hidden="true"></i>
            </button>
            <div class="search">
              <input
                type="text"
                name="searchMusic"
                id="searchMusic"
                placeholder="Buscar canción..."
              />
              <i class="fa-solid fa-magnifying-glass"></i>
            </div>
    
            <div id="upDown">
              <label for="list" class="list" id="cambio"
                ><i class="fa fa-chevron-down" aria-hidden="true"></i>
                <i class="fa fa-chevron-up" aria-hidden="true"></i
              ></label>
            </div>
            <ul
              id="playMuisc"
              oncontextmenu="return false"
              ondragstart="return false"
              onselectstart="return false"
            >
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1WMNJYLTd6wpyjyMoo5OU853j6D9g0pNi' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a
                  href="https://docs.google.com/uc?export=download&id=1WMNJYLTd6wpyjyMoo5OU853j6D9g0pNi"
                  title="Escuchar Aún Hay Algo"
                  ><span class="numero-n">1</span
                  ><span class="Nombre-artist">RBD</span>Aún Hay Algo<span
                    id="duration-music"
                    >03:35</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=10jmDVoD8oKKDAN1EVHGiwiyUkwMXeQ2m' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a
                  href="https://docs.google.com/uc?export=download&id=10jmDVoD8oKKDAN1EVHGiwiyUkwMXeQ2m"
                  title="Escuchar Celestial "
                  ><span class="numero-n">2</span
                  ><span class="Nombre-artist">RBD</span>Celestial<span
                    id="duration-music"
                    >03:27</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1MiLWPu97f1hDL1v_59dTi7fVgMko361O' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Enséñame"
                  ><span class="numero-n">3</span
                  ><span class="Nombre-artist">RBD</span>Enséñame<span
                    id="duration-music"
                    >03:42</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1ZOJiI2ZtDBZXZAYPHf8o2jBw2tNjPX_d' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Este Corazón"
                  ><span class="numero-n">4</span
                  ><span class="Nombre-artist">RBD</span>Este Corazón<span
                    id="duration-music"
                    >03:30</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1PUJSDEftyUiKXxy83VnmM7gIltUae3rF' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Inalcanzable"
                  ><span class="numero-n">5</span
                  ><span class="Nombre-artist">RBD</span>Inalcanzable<span
                    id="duration-music"
                    >04:15</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1B87khvKVNNiuwHHYSYDTOGDqEeUmZg41' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Nuestro Amor "
                  ><span class="numero-n">6</span
                  ><span class="Nombre-artist">RBD</span>Nuestro Amor<span
                    id="duration-music"
                    >03:36</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1wPqDXVHmdOCQebWJg015Bklz2K9chvD7' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Qué Hay Detrás "
                  ><span class="numero-n">7</span
                  ><span class="Nombre-artist">RBD</span>Qué Hay Detrás<span
                    id="duration-music"
                    >03:18</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1A-7RyBiUHdB9DepYBFx6HWVA7LLACwCG' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Rebelde "
                  ><span class="numero-n">8</span
                  ><span class="Nombre-artist">RBD</span>Rebelde<span
                    id="duration-music"
                    >03:34</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1JlOL7XpxDmXG1a87DGebTbri6dYQcUca' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Sálvame"
                  ><span class="numero-n">9</span
                  ><span class="Nombre-artist">RBD</span>Sálvame<span
                    id="duration-music"
                    >03:45</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1G87e6jT3pqhEWXk_LBoaQiwZbgOSjVfA' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Ser O Parecer"
                  ><span class="numero-n">10</span
                  ><span class="Nombre-artist">RBD</span>Ser O Parecer<span
                    id="duration-music"
                    >03:32</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1sVqGrJWUQcE3fjIq0T9zvOqSVHWpVRUa' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Sólo Quédate En Silencio "
                  ><span class="numero-n">11</span
                  ><span class="Nombre-artist">RBD</span> Sólo Quédate En
                  Silencio<span id="duration-music">03:40</span></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1Vd_0zWrbXyxXX9mlPw9bss3zsbaLBdyk' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Tras De Mí "
                  ><span class="numero-n">12</span
                  ><span class="Nombre-artist">RBD</span>Tras De Mí<span
                    id="duration-music"
                    >03:12</span
                  ></a
                >
              </li>
    
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1qFGt_2BWYMwcE-hQyKZ-AWtpcstlyMFg' "
                  title="Download song"
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#" title="Escuchar Un Poco De Tu Amor "
                  ><span class="numero-n">13</span
                  ><span class="Nombre-artist">RBD</span>Un Poco De Tu Amor<span
                    id="duration-music"
                    >03:26</span
                  ></a
                >
              </li>
              <li class="song">
                <span
                  onclick="location.href='https://docs.google.com/uc?export=download&id=1CMMbqk-JUhGbProI2IhcqvEVFB2KD0L7' "
                  class="enlace"
                  ><i class="fa fa-download" aria-hidden="true"></i
                ></span>
                <a href="#"
                  ><span class="numero-n">14</span
                  ><span class="Nombre-artist"> RBD </span> Siempre He Estado
                  Aquí<span id="duration-music">03:10</span></a
                >
              </li>
            </ul>
          </div>
        </section>
    
        <script src="https://cdn.plyr.io/3.6.12/plyr.polyfilled.js"></script>
        <script>
          //<![CDATA[
          const players = Array.from(document.querySelectorAll(".js-player")).map(
            (player) => new Plyr(player)
          );
          //]]>
        </script>
    

    Para agregar estilo al reproductor, insertar el código arriba de la etiqueta </body>

    
    
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: "Poppins", sans-serif;
    }
    :root {
      --main-bg-color: #0f0101;
      --main-bg-body-color: orange;
      --main-line-height: 64px;
      --main-bg-controls: transparent;
      --main-bg-color-control: #4a5464;
    }
    body {
      background: radial-gradient(
            35.36% 35.36% at 100% 25%,
            #0000 66%,
            #1b0606 68% 70%,
            #0000 72%
          )
          26px 26px / calc(2 * 26px) calc(2 * 26px),
        radial-gradient(
            35.36% 35.36% at 0 75%,
            #0000 66%,
            #1b0606 68% 70%,
            #0000 72%
          )
          26px 26px / calc(2 * 26px) calc(2 * 26px),
        radial-gradient(
            35.36% 35.36% at 100% 25%,
            #0000 66%,
            #1b0606 68% 70%,
            #0000 72%
          )
          0 0 / calc(2 * 26px) calc(2 * 26px),
        radial-gradient(
            35.36% 35.36% at 0 75%,
            #0000 66%,
            #1b0606 68% 70%,
            #0000 72%
          )
          0 0 / calc(2 * 26px) calc(2 * 26px),
        repeating-conic-gradient(#0f0101 0 25%, #0000 0 50%) 0 0 / calc(2 * 26px)
          calc(2 * 26px),
        radial-gradient(#0000 66%, #1b0606 68% 70%, #0000 72%) 0 calc(26px / 2) /
          26px 26px #0f0101;
    }
    
    .musicSearch {
      display: none;
    }
    /*SEARCH*/
    .search {
      background: transparent;
      position: absolute;
      width: 30%;
      left: 68%;
      top: 20px;
      transition: all 0.3s ease-in-out;
    }
    .search #searchMusic {
      background: rgb(43 15 17);
      width: 90%;
      bottom: 17px;
      border: none;
      border-radius: 50px;
      padding: 9px;
      color: aliceblue;
      outline: none;
    }
    .search .fa-magnifying-glass {
      font-size: 14px;
      color: rgb(138, 138, 138);
      position: absolute;
      top: 13px;
      right: 55px;
    }
    #containerPlay {
      width: 100%;
      height: 90vh;
      left: 50%;
      top: 5%;
      position: absolute;
      transform: translateX(-50%);
      border-radius: 8px;
      background: transparent;
      padding: 30px;
      overflow: hidden;
    }
    
    #imgCover {
      position: relative;
      top: -28x;
    }
    #imgCover img {
      width: 100px;
      border-radius: 5px;
      opacity: 0.9;
      transition: all 0.3s ease-in-out;
      box-shadow: 3px 3px 5px #000000, -3px -3px 5px #000000;
    }
    #information {
      position: absolute;
    
      top: 10%;
      left: 200px;
      color: rgb(238, 238, 238);
    }
    #information h2 {
      font-size: 15px;
    }
    #bodyPlay .list .fa-chevron-down {
      display: none;
    }
    /*AUDIO*/
    .plyr--audio .plyr__controls {
      position: relative;
      background: transparent;
      top: -11px;
    }
    .plyr__menu__container {
      height: 120px;
      overflow-y: scroll;
    }
    .plyr__controls .plyr__controls__item:first-child {
      position: absolute;
      z-index: -1;
      left: 46px;
      top: 39px;
      cursor: auto;
    }
    .plyr__progress__buffer,
    .plyr__progress input[type="range"] {
      color: var(--main-bg-body-color);
    }
    .plyr__volume input[type="range"] {
      color: var(--main-bg-body-color);
    }
    .plyr__volume {
      position: absolute;
      top: 39px;
      left: 17%;
    }
    .plyr__menu {
      display: none;
    }
    
    #backward {
      position: relative;
      background: none;
      right: -7px;
      top: -12px;
      border: none;
      width: 30px;
      height: 30px;
      font-size: 15px;
      border-radius: 100%;
      transition: all 0.4s ease-in-out;
      color: var(--main-bg-color-control);
    }
    
    #forward {
      position: relative;
      background: transparent;
      right: -51px;
      top: -12px;
      border: none;
      width: 30px;
      height: 30px;
      font-size: 15px;
      border-radius: 100%;
      color: var(--main-bg-color-control);
      transition: all 0.4s ease-in-out;
    }
    #backward #forward {
      border: none;
      background: none;
    }
    audio {
      position: absolute;
    }
    #list {
      display: none;
    }
    #upDown .list {
      position: relative;
      color: aliceblue;
      left: 50%;
    }
    
    /*PLAYLIST*/
    #playMuisc::-webkit-scrollbar {
      display: none;
    }
    #playMuisc {
      position: relative;
      height: 100vh;
      overflow-y: scroll;
      border-radius: 8px;
      user-select: none;
    }
    #playMuisc li {
      list-style: none;
      padding: 6px;
      border-bottom: solid 1px #858383;
    }
    #playMuisc li a {
      text-decoration: none;
      display: block;
      padding-bottom: 10px;
      padding-left: 30px;
      color: aliceblue;
      border-radius: 8px;
      cursor: auto;
      font-size: 14px;
      line-height: 40px;
    }
    .enlace {
      position: absolute;
      left: 86%;
      line-height: var(--main-line-height);
      font-size: 14px;
      visibility: hidden;
      color: aliceblue;
    }
    
    #duration-music {
      position: absolute;
      left: 93%;
      line-height: var(--main-line-height);
    }
    .Nombre-artist {
      position: absolute;
      line-height: 90px;
      left: 37px;
      font-size: 13px;
    }
    .numero-n {
      position: absolute;
      left: 9px;
      line-height: var(--main-line-height);
      width: 20px;
      height: 20px;
      text-align: center;
    }
    /*HOVER LIST*/
    #playMuisc li:hover .enlace .fa-download {
      visibility: visible;
    }
    #playMuisc li a:hover {
      color: var(--main-bg-body-color);
    }
    #playMuisc li a:hover .numero-n {
      color: var(--main-bg-body-color);
      visibility: hidden;
    }
    #playMuisc li a:hover .numero-n:before {
      font-family: "Font Awesome 5 Free";
      content: "\f01d ";
      visibility: visible;
      font-size: 20px;
    }
    .enlace {
      color: var(--main-bg-body-color);
    }
    .enlace .fa-download {
      padding: 10px;
      border-radius: 50%;
    }
    
    .enlace .fa-download:active {
      padding: 10px;
      border-radius: 50%;
      background: #285671;
      box-shadow: inset 3px 3px 5px #254f68, inset -3px -3px 5px #2b5d7a;
    }
    /*HOVER CONTROLS*/
    .plyr__controls .plyr__controls__item:first-child:hover {
      background: var(--main-bg-controls);
      border-radius: 100%;
    }
    #backward:hover {
      background: var(--main-bg-controls);
      color: white;
      transition: all 0.4s ease-in-out;
    }
    #forward:hover {
      background: var(--main-bg-controls);
      color: white;
      transition: all 0.4s ease-in-out;
    }
    .plyr--audio .plyr__control.plyr__tab-focus,
    .plyr--audio .plyr__control:hover,
    .plyr--audio .plyr__control[aria-expanded="true"] {
      background: var(--main-bg-controls);
    }
    .enlace .fa-download:hover {
      background: var(--main-bg-body-color);
      color: aliceblue;
    }
    #upDown .list:hover {
      color: var(--main-bg-body-color);
    }
    /*ACTIVE*/
    #searchMusic:active {
      background: #0d0d0d;
    }
    #playMuisc .active .numero-n:before {
      font-family: "Font Awesome 5 Free";
      content: "\f01d  ";
      visibility: visible;
      font-size: 18px;
      color: var(--main-bg-body-color);
    }
    #playMuisc .active:hover .enlace .fa-download {
      background: #000000;
      color: aliceblue;
    }
    #playMuisc .active .numero-n {
      visibility: hidden;
    }
    
    /*MAGIC*/
    
    #containerPlay > #list:checked ~ #imgCover {
      height: 100vh;
      width: 100%;
      left: 0px;
      overflow: hidden;
      position: fixed;
      top: 0px;
      border-radius: 0px;
    }
    
    #containerPlay > #list:checked ~ #imgCover img {
      width: 100%;
      box-shadow: none;
      left: 23px;
    
      transition: all 0.3s ease-in;
      border-radius: 20px;
      filter: blur(15px);
    }
    
    #containerPlay > #list:checked ~ #bodyPlay {
      background: #000000db;
      position: absolute;
      width: 100%;
      height: 100vh;
      left: 0px;
      top: 0px;
      overflow: hidden;
      padding-left: 40px;
      padding-right: 40px;
      transition: all 0.3s ease-in;
    }
    #containerPlay > #list:checked ~ #bodyPlay #playMuisc {
      position: relative;
    
      height: 100vh;
    }
    #containerPlay > #list:checked ~ #bodyPlay .list .fa-chevron-up {
      display: none;
    }
    #containerPlay > #list:checked ~ #bodyPlay .list .fa-chevron-down {
      display: block;
    }
    #containerPlay > #list:checked ~ #bodyPlay .search {
      visibility: hidden;
      left: 200%;
    }
    
    /*RESPONSEVE*/
    @media screen and (max-width: 700px) {
      .plyr__volume {
        left: 0px;
        position: relative;
        top: 0px;
      }
      .plyr__controls .plyr__controls__item:first-child {
        top: 50px;
      }
      .search .fa-magnifying-glass {
        display: none;
      }
      #duration-music {
        visibility: hidden;
      }
      #duration-music:before {
        font-family: "Font Awesome 5 Free";
        color: whitesmoke;
        content: "\f192";
        visibility: visible;
      }
      #playMuisc .enlace .fa-download {
        right: -30px;
      }
      #information {
        left: 150px;
      }
      #information h1 {
        font-size: 12px;
      }
      #information h2 {
        font-size: 11px;
      }
    }
    @media screen and (max-width: 400px) {
      #duration-music {
        display: none;
      }
    }
    
    

    Agregar el siguiente código arriba de la etiqueta </body>el codigo da funcionamiento al buscador

    
    document.addEventListener("keyup", (e) => {
      if (e.target.matches("#searchMusic")) {
        if (e.key === "Enter") e.target.value = "";
    
        document.querySelectorAll(".song").forEach((songSerch) => {
          songSerch.textContent.toLowerCase().includes(e.target.value.toLowerCase())
            ? songSerch.classList.remove("musicSearch")
            : songSerch.classList.add("musicSearch");
        });
      }
    });
    
    

    Por último agregar el siguiente código arriba de la etiqueta </body>el codigo da funcionamiento al reproductor

    
    var audio;
    var playMuisc;
    var tracks;
    var current;
    initaudio();
    function initaudio() {
      current = 0;
      audio = $("audio");
      playlist = $("#playMuisc");
      tracks = playlist.find("li a");
      len = tracks.length - 1;
      audio[0].volume = 1;
    
      playlist.find("a").click(function (e) {
        e.preventDefault();
        link = $(this);
        current = link.parent().index();
        runaudio(link, audio[0]);
      });
    
      audio[0].addEventListener("ended", function (e) {
        current++;
        if (current > len) {
          current = 0;
          link = playlist.find("a")[0];
        } else {
          link = playlist.find("a")[current];
        }
        runaudio($(link), audio[0]);
      });
    }
    
    function runaudio(link, player) {
      player.src = link.attr("href");
      par = link.parent();
      par.addClass("active").siblings().removeClass("active");
    
      audio[0].load();
      audio[0].play();
    }
    
    
    

    Nota:


    abril 04, 2022

    Función copiar texto al portapapeles, html, css, js

    Esta función en si permite copiar textos que se encuentra dentro de un div, se utilizara: HTML, CSS, JS.


    Nota: El diseño original pueden encontrar en Codepen


    Primeramente se necesita un icono que nos permita referenciar un botón de copiar, puede colocar la palabra copiar u optar por un icono.
    En esta ocasión se utilizo la libraría Font Awesome para integrar el icono.


    Pasos para insertar el codigo


    Debajo de la etiqueta <head> inserte el código script, el siguiente código nos permite visualizar los iconos de Font Awesome

    
     <script crossorigin="anonymous" src="https://kit.fontawesome.com/cf0160c90b.js"></script>
    

    Luego se incluye debajo de la etiqueta <body> la estructura HTML. Consiste en cuatro id: contenedor, enlace, copiador, exito.
    A si vez con una class: exito

    
    <div id="contenedor">
      <div>
        <span id="enlace">
          https://ectryc.blogspot.com
        </span>
        <button id="copiador"> <i class="fa fa-clone" aria-hidden="true"></i> </button>
          <p class="exito" id="exito"> Copiado</p>
      </div>
       
    </div>
    

    Posteriormente insertamos el código CSS arriba de la etiqueta </body> para el diseño. Puede modificar el color del body en la propiedad background-color:


    
    <style type="text/css">
    
    body {
        background-color: #5c1433;
    }
    
    #contenedor {
        width: auto;
        height: 200px;
        margin: 0px auto;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    #contenedor > div {
        display: flex;
    }
    
    span#enlace {
        color:#a99384;
        font-size: 1.3em;
        padding: 9px 14px;
        background: #5c1433;
        box-shadow:  6px 6px 12px #54122e,
                 -6px -6px 12px #641638;
        border-top-left-radius: 10px;
        border-bottom-left-radius: 10px;
       -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none; 
    }
    
    button#copiador {
        background:#370b1e;
        box-shadow:  6px 6px 12px #54122e,
                 -6px -6px 12px #641638;
        color: #a99384;
        border: none;
        padding: 10px;
        font-size: 1.2em;
        display: inline-block;
        border-top-right-radius: 10px;
        border-bottom-right-radius: 10px;
        cursor: pointer;
    }
    
    button#copiador:hover {
        background-color:#49122a; color: #000;
    }
    
    button#copiador:hover .fa-clone{
          transition: 0.5s;
          transform: rotate(45deg);
    }
     .fa-clone{
          transition: 0.5s;
    }
    
    button#copiador:active {
        transform: scale(1.01);
        background: #370b1e;
        box-shadow: inset 6px 6px 12px #2e0919,
                inset -6px -6px 12px #400d23;
    
    }
    
    button#copiador:focus {
        outline: none;
    } 
    .exito{
        background: #000; 
        position:absolute; 
        top: 7%; 
        left:58%; 
        border-radius:3px;
        padding: 3px; 
        color: brown;
        display: none; 
        font-size: 12px;}
    .exito-activo{
        display: block}
    </style>
    

    Finalmente se inserta el código Js arriba de la etiqueta </body>


    
    
    <script type="text/javascript">  
    var boton = document.getElementById("copiador");
    boton.addEventListener("click", copiarAlPortapapeles, false);
        
    function copiarAlPortapapeles() {
      var enlace = document.getElementById("enlace");
      var inputFalso = document.createElement("input");
      inputFalso.setAttribute("value", enlace.innerHTML);
    
      document.body.appendChild(inputFalso);
    
      inputFalso.select();
        
      document.execCommand("copy");
        
      const boton = document.getElementById('copiador'); 
      if(enlace){
            document.body.removeChild(inputFalso);
           document.getElementById('enlace').style.color='#000';
         	document.getElementById('exito').classList.add('exito-activo');
    		setTimeout(() => {
                document.getElementById('enlace').style.color='#a99384';
    			document.getElementById('exito').classList.remove('exito-activo');
    		}, 1000);
         
         }
    }
    
    </script>
    
    

    Nota:
    Puede insertar Función copiar texto al portapapeles en un Gadget en blogger de la siguiente manera:

    • Accede a Blogger.
    • En el menú de la izquierda, haz clic en Diseño.
    • En la sección donde quieras mostrar las páginas, haz clic en Agregar un gadget.
    • Haz clic en el gadget HTML/JavaScript, luego inserta el código.

    Segundo modo


    Usando Clipboard.js se puede realizar la misma función de una manera mas sencilla sin mucho código.
    Primeramente incluiremos la librería clipboard.js

    
    <script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>  
    

    Seguido dentro de la etiqueta <body> agregamos el siguiente código HTML.

    
    <div class="text_copy">
        <p> <span id = "texto">Bienvenido a Ectryc </span> </p>
        <button class="btn" data-clipboard-action="copy" data-clipboard-target="#texto"><i class="fa fa-clone" aria-hidden="true"></i></button> 
    </div>
    <div class="text_copy">
        <p> <span id = "texto1">Welcome to Ectryc</span> </p>
        <button class="btn" data-clipboard-action="copy" data-clipboard-target="#texto1"><i class="fa fa-clone" aria-hidden="true"></i></button> 
    </div>
    

    Para agregar estilo insertamos el siguiente código CSS seguido del código HTML.

    
    <style>
           body{background:#252525; color: white;}
           .text_copy{ background:#8b3d09; padding: 5px; border: solid 1px #582604; border-radius: 5px;}
           .btn{background:#3c1c06;
            color: aliceblue; 
            border:solid 0px; 
            position: relative; 
            top:-52px; 
            z-index: 9999999; 
            float: right; 
            padding: 3px; 
            border-radius: 3px;}
           .btn:hover{background:#9bee77; color: #000}
    </style>
    
    

    Por último inserta el script arriba de la etiqueta </body> .

    
    <script>
         var clipboard = new Clipboard('.btn');
              /*Visualizar en consola*/
          clipboard.on('success', function (e) {
            console.info('Action:', e.action);
            console.info('Text:', e.text);
            console.info('Trigger:', e.trigger);
          });
    
          clipboard.on('error', function (e) {
            console.info('Action:', e.action);
            console.info('Text:', e.text);
            console.info('Trigger:', e.trigger);
          });
    </script>
    

    marzo 07, 2022

    Reproductor de audio con HTML CSS JS

    Reproductor de audio sencillo utilizando HTML, CSS, JS, con lista de reproducción, iconos insertados a través de Font awesome a continuación una lista detallada del reproductor:

  • Opción de descarga de audio.
  • Responsive.
  • Lista de reproducción.

  • Instalar

    Primeramente debemos Insertar el código abajo de la etiqueta <head>

    
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdn.plyr.io/3.6.12/plyr.css"/><!--CSS audio-->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script><!--Libreria jQuery js-->
    <script src="https://kit.fontawesome.com/cf0160c90b.js" crossorigin="anonymous"></script><!--font-awesome-->
    

    Insertar el código abajo de la etiqueta <body>

    
        <div class="pantalla" id="pantalla" >
            <button id="ellipsis"><i class="fa fa-ellipsis-v" aria-hidden="true"></i>
                <div class="ellipsis">
                    <li class="switch" id="switch"></li>
                    <li class="switch_Neumorphism" id="switch_Neumorphism"></li>
                </div>
            </button>
            <div class="screen">
                <div class="ecualizador" id="ecualizador"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKm5JraOQvzCzKnhhBd7dKN6hZ1c1PDgL-JhHtLcewYrELd6ZWqEQa9CtfP8juJ0F9cxEEp643mBaqhQqYPiSb__fk-xiDWDV-7ztfRH4trSqDcwDit5NIVBEmht7FGfCoaEnMaoAnLM1lA8-UrLNeN8SAT3ckjQvPmcsjILR2NBGrxAIpjLRvIcIi/s320/equalizador.gif" >
                </div>
                <div class="cover_info">
                    <div class="caratula_img" id="caratula">
                        <img src="https://blogger.googleusercontent.com/img/a/AVvXsEhZSQguaq4sxxiG74tLMbPW43fXM36BncLcjeByGlcLfEtvkApyGvq1eJ8d5ksRcRJo_A4MdjO1jf-p3u1Sk-ssicbOoHWXqXaMHWdHUAh-ycuorSGR5V0yLrGmvyF2KsNjMgZfQvX2buVgDSYLbzwCzCnM_LriwCgC9gPNtDsQJArYm-yOfoQgY9hD">
                    </div>
                    <div class="informacion">
                        <h1>Lagrimas desordenadas </h1>
                        <h2> Melendi </h2>
                    </div>
                </div>
                <div id="player" oncontextmenu="return false"  ondragstart="return false" >
                    <ul id="playlist">
                        <li> <a href="https://docs.google.com/uc?export=download&id=1OGlxb_w5Gq_DFQ_28STBBMPUfOpuzWyx"><span class="numero-n">1</span><span class="Nombre-artist"> Melendi  </span> Tu jardín con enanitos<span id="duration-music">03:59</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=1OGlxb_w5Gq_DFQ_28STBBMPUfOpuzWyx' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
    
                        <li> <a href="https://docs.google.com/uc?export=download&id=18zrxsPgC2zZZ7lGuAdd_nneuGBKjecYX"><span class="numero-n">2</span><span class="Nombre-artist"> Melendi  </span> Lágrimas desordenadas<span id="duration-music">03:51</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=18zrxsPgC2zZZ7lGuAdd_nneuGBKjecYX' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
    
                        <li> <a href="https://docs.google.com/uc?export=download&id=15MvB1Y0PNunKH3ZBAUzGjXLGmQ6a9A4u"><span class="numero-n">3</span><span class="Nombre-artist"> Melendi  </span> Cheque al portamor<span id="duration-music">04:55</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=15MvB1Y0PNunKH3ZBAUzGjXLGmQ6a9A4u' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
    
                        <li class="mySlides"> <a href="https://docs.google.com/uc?export=download&id=1h6glZ0eslWhfroLpJQKpc8Q-wJ_PwY-f"><span class="numero-n">4</span><span class="Nombre-artist"> Melendi  </span> Tu lista de enemigos<span id="duration-music">04:02</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=1h6glZ0eslWhfroLpJQKpc8Q-wJ_PwY-f' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
    
                        <li><a href="https://docs.google.com/uc?export=download&id=1DHL8HIE77unkFe1mgAUqHi6qRM_S1TU-"><span class="numero-n">5</span><span class="Nombre-artist"> Melendi  </span> Aprendiz de caballero<span id="duration-music">04:04</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=1DHL8HIE77unkFe1mgAUqHi6qRM_S1TU-' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
    
                        <li><a href="https://docs.google.com/uc?export=download&id=1pyqIwYXKpAuBuZw6oamMr3sK-Jw5aunF"><span class="numero-n">6</span><span class="Nombre-artist"> Melendi  </span> Autofotos<span id="duration-music">03:31</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=1pyqIwYXKpAuBuZw6oamMr3sK-Jw5aunF' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
    
                        <li><a href="https://docs.google.com/uc?export=download&id=1Z9X-DmHMVsDERSSMgB29ToyXxaQV3Co-"><span class="numero-n">7</span><span class="Nombre-artist"> Melendi  </span> Mi primer beso<span id="duration-music">04:16</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=1Z9X-DmHMVsDERSSMgB29ToyXxaQV3Co-' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
    
                        <li><a href="https://docs.google.com/uc?export=download&id=1SMEXXaEhTlihh03BEs45eOmHoFo41x1l"><span class="numero-n">8</span><span class="Nombre-artist"> Melendi  </span> La tortura de Lyss<span id="duration-music">03:55</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=1SMEXXaEhTlihh03BEs45eOmHoFo41x1l' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
    
                        <li><a href="https://docs.google.com/uc?export=download&id=1JP5avEGnNZueCMViPGuLd8hxMSxUONuA"><span class="numero-n">9</span><span class="Nombre-artist"> Melendi  </span> De pequeño fue el Coco<span id="duration-music">04:03</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=1JP5avEGnNZueCMViPGuLd8hxMSxUONuA' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
    
                        <li><a href="https://docs.google.com/uc?export=download&id=1yiy8BeLIVWvTAPNMc7nVzlV6-MzDlVrU"><span class="numero-n">10</span><span class="Nombre-artist"> Melendi  </span> Gatos celestes<span id="duration-music">03:47</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=1yiy8BeLIVWvTAPNMc7nVzlV6-MzDlVrU' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
    
                        <li><a href="https://docs.google.com/uc?export=download&id=1FuvJIM6GHIG3F4ACKoBIpa3zH0Bz9OCP"><span class="numero-n">11</span><span class="Nombre-artist"> Melendi  </span> De repente desperté<span id="duration-music">05:10</span ><span onclick="location.href='https://docs.google.com/uc?export=download&id=1FuvJIM6GHIG3F4ACKoBIpa3zH0Bz9OCP' "title="Download song" class="enlace"><i class="fa fa-download" aria-hidden="true"></i></span></a></li>
                        <br>
                    </ul>
                </div>
            </div>
            <div class="Reproductor-audio">
                <audio class='js-player'>
                    <source src="https://docs.google.com/uc?export=download&id=1OGlxb_w5Gq_DFQ_28STBBMPUfOpuzWyx" type="audio/mp3">
                </audio>
            <div class="botones-audio">
                <button type="button" data-tiempo="-30" class="fast_boton"><i class="fa fa-fast-forward fa-flip-horizontal" aria-hidden="true"></i></button>
                <button type="button" class="replay" onclick="reload()"><i class="fa fa-square" aria-hidden="true"></i></button>
                <button type="button" class="control_song" id="control_song" onclick="control()"><i class="fa fa-play" aria-hidden="true"></i></button>
                <button type="button" data-tiempo="30" class="fast_boton"><i class="fa fa-fast-forward" aria-hidden="true"></i></button>
            </div>
        </div>
    </div>
    

    Para agregar estilo al reproductor, insertar el código arriba de la etiqueta </body>

    
    <style type="text/css">
    @import url('https://fonts.googleapis.com/css2?family=Anek+Odia:wght@200&family=Raleway:wght@100&display=swap');
    body{background:#fff; transition: all 0.9s ease-in}
    .pantalla{
        width:80%;
        position: relative;
        margin-left: 9%; 
        overflow: hidden;
        font-family: sans-serif;
        border-radius: 10px; 
        user-select: none;}
    .ecualizador{
        position: absolute; 
        z-index: 9; 
        display: none; 
        transform:rotate(180deg); 
        top: -6px}
    .screen{
        background:#ededed;
        border-radius: 10px 10px 0px 0px }
    .caratula_img img{
        position: relative; 
        width: 45%;
        border-radius: 10px 0px 0px 0px;}
    .informacion{
        position:absolute;
        float: left; top: 0%;
        left: 46%; color:#212429;
        line-height: 6px}
    .informacion h1{
        font-size: 20px}
    .informacion h2{
        font-size: 15px}
    .titulo_numero{
        background:none;
        position: relative;
        color:#000;
        right: -2%}
    #playlist{
        background:#ededed; 
        position: absolute; 
        width:52.4%; 
        height:77%; 
        overflow-x: hidden; 
        top: 44px;
        left: 45%;   
        }
    #playlist::-webkit-scrollbar {
        width: 15px;}
    #playlist::-webkit-scrollbar-track {
        background:transparent; }
    #playlist::-webkit-scrollbar-thumb {
        background:#6c6a6a;}
    #playlist::-webkit-scrollbar-thumb:hover {
        background:#a2a0a0;}
    #playlist li{
        width: 109%;
        position: relative;
        list-style: none;
        display: block;
        padding-left: 10px;
        left: -8%;
        transition: all 0.2s ease-in;}
    #playlist li a{
        font-size: 14px;
        left: 20px; 
        color:#212429;
        padding: 15px; 
        display: block; 
        text-decoration: none;
        position:relative;}
    #playlist li .numero-n{
        position:absolute; 
        left: -12px;}
    #playlist li #duration-music{
        float:right; 
        right: 35px; 
        position: relative}
    #playlist li .Nombre-artist{
        position: absolute; 
        top: 30px; 
        opacity: .5; 
        left: 16px; 
        font-size: 12px; 
        padding-top:2px ;}
    #playlist li .enlace{
        display: none; 
        float: right; 
        background:none; 
        position: relative; 
        right: 45px; 
        transition: all 0.2s ease;} 
    .footer .creditos{
        position:relative;}
    /*Reproductor*/
    .Reproductor-audio{
        background:#ededed;
        width: 100%;
        height:60px;
        position: relative;
        top: 0px;
        margin: 0px;
        padding: 0px;}
    .plyr--audio{
        position:relative;
        background:#2a1f2400;
        height: 25px; 
        top: 0px}
    .plyr--audio .plyr__controls{
        background:transparent;
        width: 85%;
        float: right;
        position: relative;}
    .plyr__volume input[type=range]{color: #101010}
    .plyr--audio .plyr__control[aria-expanded=true]{color: #212429}
    .plyr--full-ui a, .plyr--full-ui button{color: #e5e5e5;}
    .plyr--audio .plyr__control[aria-expanded=false]{display: none}
    .plyr__controls .plyr__controls__item:first-child{display: none}
    .plyr--full-ui a, .plyr--full-ui button, .plyr--full-ui input, .plyr--full-ui label{color:#212429}
    .botones-audio{
        position:absolute; 
        left: 1%; 
        top: 9px;}
    .botones-audio .control_song{
        background: none; 
        color:#212429; 
        width: 35px; 
        height: 35px;  
        border-radius: 100%; 
        padding:10px; 
        border:solid 0px; 
        font-size: 14px}
    .botones-audio .fast_boton{
        background: none;
        color:#212429;
        width: 35px;
        height: 35px;
        border-radius: 100%;
        padding:10px;
        border:solid 0px;
        font-size: 14px}
    .botones-audio .replay{
        background: none;
        color:#212429;
        width: 35px;
        height: 35px;
        border-radius:100%;
        padding:10px;
        border:solid 0px;
        font-size: 14px}
      /*HOVER*/
    .plyr--audio .plyr__control.plyr__tab-focus, .plyr--audio .plyr__control:hover, .plyr--audio .plyr__control[aria-expanded=true]{background: transparent; color: #3f51b5}
    #playlist li:hover{
        background:#858585; 
        transition: all 0.2s ease-in; }
    #playlist li a:hover{color: #000 }
    #playlist li:hover .enlace{display: block; color:white;}
    #playlist .fa-download:hover{color:black;}
    #playlist li:hover .numero-n{color: transparent}
    #playlist li:hover .numero-n:before {color: whitesmoke;content: "\25B6";} 
        /*ELLIPSIS*/
    #ellipsis{display: relative; float: right; background: none; color:#212429; border: none; margin: 10px}
    .ellipsis{
        background:none; 
        display: none;
        position: absolute;
        width: 30px;
        right: 25px;
        top: 12px}
    .ellipsis li{list-style: none;  height: 15px; border-radius: 10px;}
    .switch{background:rgb(26,20,23) }
    .switch {
        background: #2f3130;
        border-radius: 1000px;
        border: none;
        position: relative;
        cursor: pointer;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        outline: none;
    }
    .switch::after {
        content: "";
        display: block;
        width: 15px;
        height: 15px;
        position: absolute;
        background: #F1F1F1;
        top: -1px;
        left: 0;
        right: unset;
        border-radius: 100px;
        border: solid 1px #2f3130;
        -webkit-transition: .3s ease all;
        transition: .3s ease all;
        -webkit-box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.2);
        box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.2);}
    .switch.active {
        background:#fff;}
    .switch.active::after {
        right: 0;
        left: unset;
        background: #2f3130;
        border: solid 1px #F1F1F1 ;}
    .switch span {
        width: 30px;
        height: 30px;
        line-height: 30px;
        display: block;
        background: none;
        color: #fff;
    }
    /*ACTIVE*/
    #playlist .active .numero-n:before {
        color:#212429;
        font-weight: 600;
        content: "\275A \275A";}
    .botones-audio .control_song:active{
        box-shadow: inset 2px 2px 4px #0b0b0b,
                    inset -2px -2px 4px #191919;}
    .botones-audio .fast_boton:active{
        box-shadow: inset 2px 2px 4px #0b0b0b,
                    inset -2px -2px 4px #191919;}
    .botones-audio .fast1_boton:active{
        box-shadow: inset 2px 2px 4px #0b0b0b,
                    inset -2px -2px 4px #191919;}
    .botones-audio .replay:active{box-shadow: inset 2px 2px 4px #0b0b0b,
                inset -2px -2px 4px #191919;}
    #playlist li:active{
        box-shadow: inset 9px 9px 18px #5d5b5b,
                    inset -9px -9px 18px #7b7979;}
    #playlist .active:hover .numero-n:before{
        color: whitesmoke;
        content: "\275A \275A";}
    .plyr--audio .plyr__control.plyr__tab-focus, .plyr--audio .plyr__control:active, .plyr--audio .plyr__control[aria-expanded=true]{
        box-shadow: inset 2px 2px 4px #0b0b0b;
                    inset -2px -2px 4px #191919;
                    border-radius: 100%;} 
     /*BEFORE*/
    #playlist .active {background:#ada7a7; font-weight: 500; }
    #playlist .active .numero-n{color: transparent}  
    /*DARK*/
    body.dark{background-image: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtz1EIKaJXJl3QDvGQOaVBrTgLVONGSVLZCwpBdnoTrgFT0JlKgElaB4To6LXCwRrUJRGbSo-rdFP6_iiEmFOKdex8kRRvY0H-ZtFA-C0LLsh8NDz69iYGlBMeK8oFkD4DTQBQFkGvANv-JpIOHS3cJc2dcZ_jloPtDZWEzPxKNa1liIcJz4cIFhhjrQ/s640/CD-Art.png); transition: all 0.9s ease-in}
    body.dark .screen{background:#222429a8; }
    body.dark  #ellipsis{color:#ededed}
    body.dark .informacion{color:#ededed;}
    body.dark #playlist{background:transparent}
    body.dark .Reproductor-audio{background:#222429a8}
    body.dark #playlist li a{color:#ededed }
    /*AUDIO*/
    body.dark .plyr__progress__buffer, .plyr__progress input[type=range] {color:#101010;}
    body.dark .plyr--full-ui a, .plyr--full-ui button { color:#ada7a7 ;}
    body.dark .plyr__controls .plyr__controls__item:first-child{ color: #ada7a7;}
    body.dark .botones-audio .fast_boton{background: none; color:#ada7a7;  }
    body.dark .botones-audio .control_song{background: none; color:#ada7a7; }
    body.dark .botones-audio .replay{background: none; color:#ada7a7;}
     /*DARK ACTIVE*/
    
        /*MEDIA SCREEN*/
    @media screen and (max-width:1075px){
    .plyr--audio .plyr__controls {width: 81%;}}
    @media screen and (max-width:990px){
    .plyr--audio .plyr__controls {width: 75%;}}
    @media screen and (max-width:990px){
    .pantalla { width: 100%; margin-left: 0%;}}
     @media screen and (max-width:860px){
    #playlist{top: 42px; height: 73%;}}   
     @media screen and (max-width:700px){
    #playlist{background: transparent; position: relative; left: 0px;width: 95%; height: 400px;top: 0px;}
    .informacion {
            top: 15%;
            left: 47%;
            height: 80px}
    body.dark.Reproductor-audio{
            top:-16px; 
            background: #000000}
    .Reproductor-audio{
            top:-16px; }
    .botones-audio{
            left: 40%; 
            top: 25px;}
    body.dark .Reproductor-audio{
           top:-16px; 
           background: #000000}
    .plyr__volume{display: none}
    .plyr--audio .plyr__controls{width: 100%;}}
    @media screen and (max-width:600px){.informacion h1{font-size: 90%}}
    @media screen and (max-width:450px){
        .botones-audio{left: 31%; }
        .informacion{}
        .caratula_img img{ }#ellipsis {}}
    @media screen and (max-width:360px){
        .plyr__controls .plyr__controls__item.plyr__time{font-size: 10px}
        #playlist{    left: -16px;}
        .botones-audio{left: 27%; top: 25px;}
        .informacion{display: none}
        #duration-music{display: none}}
    </style>
    

    Por último agregar el siguiente código arriba de la etiqueta </body>

    
    <script>
    //<![CDATA[
    var audio;
    var playlist;
    var tracks;
    var current;
    var ecualizador;
    var icon_play ='<i class="fa fa-play" aria-hidden="true"></i>';
    var icon_pause ='<i class="fa fa-pause" aria-hidden="true"></i>';
    let control_song =document.getElementsByTagName("audio")[0];
    let sound = false;
    const botonesTiempo = document.querySelectorAll('[data-tiempo]');
    init();
    function init(){
        current = 0;
        audio = $('audio');
        playlist = $('#playlist');
        tracks = playlist.find('li a');
        len = tracks.length - 1;
        audio[0].volume = 1;
        playlist.find('a').click(function(e){
        e.preventDefault();
        link = $(this);
        current = link.parent().index();
        run(link, audio[0]);      
     });
        audio[0].addEventListener('ended',function(e){
            current++;
            if(current > len){
                current = 0;
                link = playlist.find('a')[0];
            }else{
                link = playlist.find('a')[current];    
            }
            run($(link),audio[0]);
        });
    }
    function run(link, player){
        player.src = link.attr('href');
        par = link.parent();
        par.addClass('active').siblings().removeClass('active');
        document.getElementById('ecualizador').style.display="block";
        document.getElementById('control_song').innerHTML= icon_pause;
        audio[0].load();
        audio[0].play();       
    }
    function next(){
        player.src = link.attr('href');
        par = link.parent();
        par.addClass('active').siblings().removeClass('active');
        audio[0].load();
        audio[0].play();}
    function control(){
      if(!sound){
            audio[0].play();
            document.getElementById('control_song').innerHTML= icon_pause;
            document.getElementById('ecualizador').style.display="block";
            document.getElementById('control_song').innerHTML= icon_pause;
            par.addClass('active');
            sound = true;           
      }else{
            audio[0].pause();
            document.getElementById('control_song').innerHTML= icon_play;
            par.removeClass('active');
            document.getElementById('ecualizador').style.display="none";
            sound = false;  
        }      
      }
    function reload() {
        control_song.load();
        document.getElementById('control_song').innerHTML= icon_play;
        document.getElementById('ecualizador').style.display="none";
        par.removeClass('active');}
    function saltar() {
        control_song.currentTime += parseFloat(this.dataset.tiempo);}
        botonesTiempo.forEach(button => button.addEventListener('click', saltar));
        
    $(document).ready(function(){
        $("#pantalla").on("auxclick", function(e){
          return false;
        });
        $("#pantalla").on("contextmenu", function(e){
            return false;
        });
        $(".caratula_img").on("dragstart", function(e){
            return false;
        });
        $("#ellipsis").click(function(e){
           $(".ellipsis").toggle("low")
        });
    });
    //dark
    const btnSwitch = document.querySelector('#switch');
    btnSwitch.addEventListener('click', () => {
    	document.body.classList.toggle('dark');
    	btnSwitch.classList.toggle('active');
    	// Guardamos el modo en localstorage.
    	if(document.body.classList.contains('dark')){
    		localStorage.setItem('dark-mode', 'true');
    	 } else {
    	    localStorage.setItem('dark-mode', 'false');
    	}
    });
    // Obtenemos el modo actual.
    if(localStorage.getItem('dark-mode') === 'true'){
    	document.body.classList.add('dark');
    	btnSwitch.classList.add('active');
    }else{
    	document.body.classList.remove('dark');
    	btnSwitch.classList.remove('active');
    }
        //]]>  
    </script> 
    
    <!--JS Audio-->
    <script src="https://cdn.plyr.io/3.6.12/plyr.polyfilled.js"></script>
    <script>//<![CDATA[
    const players = Array.from(document.querySelectorAll('.js-player')).map(player => new Plyr(player));
    //]]>
    </script>
    

    Nota:


    marzo 04, 2022

    CSS::-webkit-scrollbar

    ::-webkit-scrollbar nos permite personalizar la barra de desplasamiento, pero no es compatible con ciertos navegadores.

    
    /* width */
    ::-webkit-scrollbar {
      width: 10px;
    }
    /* Track */
    ::-webkit-scrollbar-track {
      background:#2d0d35; 
    }
    /* Handle */
    ::-webkit-scrollbar-thumb {
      background: #601f70; 
    }
    /* Handle on hover */
    ::-webkit-scrollbar-thumb:hover {
      background:#923fa6; 
    }
    

    Nota: las barras de desplazamiento personalizadas no son compatibles con Firefox o Edge, versión anterior 79.


    crear barras de desplazamiento personalizada


    ::-webkit-scrollbarpseudo elemento no estándar, permite modificar la apariencia de la barra de desplazamiento del navegador. Los navegadores que admiten son: Chrome, Edge, Safari y Opera admite.


    En este ejemplo encontaras un diseño que cuenta con 12 px de ancho, color de barra rebeccapurple, pista de color violet

    
    /* width */
    ::-webkit-scrollbar {
      width: 12px;
    }
    
    /* Track */
    ::-webkit-scrollbar-track {
      background:#663399; 
    }
     
    /* Handle */
    ::-webkit-scrollbar-thumb {
      background:#ee82ee; border-radius:12px;
    }
    
    /* Handle on hover */
    ::-webkit-scrollbar-thumb:hover {
      background:#d8bfd8; 
    }
    

    Barra de desplazamiento

    Pueden usar los siguientes pseudo elementos para personalizar la barra de desplazamiento del navegador:


    ::-webkit-scrollbar

    Barra de desplazamiento

    ::-webkit-scrollbar-button

    Botones de la barra de desplazamiento.

    ::-webkit-scrollbar-thumb

    Controlador de desplazamiento arrastrable.

    ::-webkit-scrollbar-track

    Pista barra de desplazamiento.

    ::-webkit-scrollbar-track-piece

    Pista (barra de progreso) NO está cubierta por el mango.

    ::-webkit-scrollbar-corner

    Esquina inferior de la barra de desplazamiento

    ::-webkit-resizer

    Controlador de cambio de tamaño arrastrable que aparece en la esquina inferior de algunos elementos.

    CSS ::selection

    ::selection CSS pseudo-elemento aplica diseño al documento que ha sido designado.

    
    ::selection {
        background: #405058;
        color: burlywood;
    }
    

    Ejemplo

    Texto seleccionado de color HotPink sobre un fondo FireBrick, Aplicable en unas pocas propiedades CSS, color, fondo, cursor y contorno.

    
    
    /* dibuja en cualquier texto seleccionado de color HotPink  sobre un fondo FireBrick*/
    ::-moz-selection { color:#FF69B4;  background:#B22222; }
    ::selection      { color:#FF69B4;  background: #B22222; }
    

    Texto de un parrafo seleccionado de color LemonChiffon y Morado

    
    /* Texto seleccionado de color LemonChiffon y Morado*/
    p::-moz-selection { color: white;  background: green; }
    p::selection      { color: white;  background: green; }