card.js 795 B

1234567891011121314151617
  1. document.querySelector('#card-number').oninput = function () {
  2. let cardNum = this.value;
  3. if (cardNum.trim().length > 5) {
  4. let cardInfo = new CardInfo(cardNum.trim(), {
  5. banksLogosPath: './node_modules/card-info/dist/banks-logos/',
  6. brandsLogosPath: './node_modules/card-info/dist/brands-logos/'
  7. });
  8. // bank name
  9. console.log(cardInfo.bankName);
  10. console.log(cardInfo.bankLogo);
  11. console.log(cardInfo.brandLogo);
  12. console.log(cardInfo.backgroundColor);
  13. document.querySelector('.card-image').src = cardInfo.bankLogo;
  14. document.querySelector('.card-logo').src = cardInfo.brandLogo;
  15. document.querySelector('.card-front').style.backgroundColor = cardInfo.backgroundColor;
  16. }
  17. }