Modulshop - Eine große Auswahl an neuen und hilfreichen Modulen für die modified eCommerce Shopsoftware
Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: ANLEITUNG: Button Passwort sichtbar machen

    noRiddle (revilonetz)

    • Experte
    • Beiträge: 13.984
    • Geschlecht:
    Re: ANLEITUNG: Button Passwort sichtbar machen
    Antwort #15 am: 20. Februar 2022, 16:54:13
    Hier mal noch 'ne Variante ohne FontAwesome nur mit CSS:

    /templates/YOUR_TEMPLATE/javascript/extra/show_pass.js.php
    Code: PHP  [Auswählen]
    <?php
    //BOC "show pass" implementation, 02-2022, noRiddle
    ?>
    <script>
    $(function() {
      if($('input[type="password"]').length) {
        let $ipw = $('input[type="password"]'),
            sh_pw = ' <span class="shw-pw eye"></span>';
        $ipw.each(function() {
          let th = $(this).outerHeight(),
              icfs = 22,
              nth = th/2 - icfs/2;
          $(this).wrap('<div class="pssw-wrap" style="position:relative;"></div>');
          $(sh_pw).insertAfter($(this)).css({'position':'absolute', 'top':nth, 'right':'5px', 'font-size':icfs+'px', 'color':'#555', 'cursor':'pointer'});
        });
        $('.shw-pw').on('click', function() {
          let $tpi = $(this).prev('input');

          $(this).toggleClass("eye eye-slash");

          if($tpi.attr('type') == 'password') {
            $tpi.prop('type', 'text');
          } else if($tpi.attr('type') == 'text') {
            $tpi.prop('type', 'password');
          }
        });
      }
    });
    </script>
    <?php
    //EOC "show pass" implementation, 02-2022, noRiddle
    ?>

    CSS:
    Code: CSS  [Auswählen]
    /*BOC for "show pass" function, 02-2022, noRiddle*/
    .eye, .eye-slash {
      width:20px;
      height:20px;
      border:1px solid #000;
      border-radius:75% 15%;
      transform:rotate(45deg);
    }
    .eye:before, .eye-slash:before {
      content:'';
      position: absolute;
      width: 6px;
      height: 6px;
      border: solid 1px #000;
      border-radius: 50%;
      left: 6px;
      top: 6px;
    }
    .eye-slash:after {
      content:'';
      width:0;
      height:28px;
      position:absolute;
      left:50%;
      top:-5px;
      color:#000;
      border:1px solid #000;
    }
    /*EOC for "show pass" function, 02-2022, noRiddle*/
    /*CSS inspiration from https://codepen.io/wentin/pen/mezPVw*/

    Wer das Auge etwas konturierter möchte (spitzere Augenwinkel)  gibt bei
    Code: CSS  [Auswählen]
    border-radius:75% 15%;
    statt dessen z. B. das an
    Code: CSS  [Auswählen]
    border-radius:75% 10%;

    Experimentiert selbst.

    Gruß,
    noRiddle
    0 Antworten
    2025 Aufrufe
    12. Mai 2012, 18:09:54 von Romy
    8 Antworten
    3992 Aufrufe
    11. April 2013, 09:09:31 von robertko
    1 Antworten
    2075 Aufrufe
    24. Oktober 2014, 17:10:09 von innuXTC
    3 Antworten
    3088 Aufrufe
    16. November 2010, 14:48:32 von ulli01