Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

front-page-pricing.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Pricing
  3. */
  4. 'use strict';
  5. document.addEventListener('DOMContentLoaded', function (event) {
  6. (function () {
  7. const priceDurationToggler = document.querySelector('.price-duration-toggler'),
  8. priceMonthlyList = [].slice.call(document.querySelectorAll('.price-monthly')),
  9. priceYearlyList = [].slice.call(document.querySelectorAll('.price-yearly'));
  10. function togglePrice() {
  11. if (priceDurationToggler.checked) {
  12. // If checked
  13. priceYearlyList.map(function (yearEl) {
  14. yearEl.classList.remove('d-none');
  15. });
  16. priceMonthlyList.map(function (monthEl) {
  17. monthEl.classList.add('d-none');
  18. });
  19. } else {
  20. // If not checked
  21. priceYearlyList.map(function (yearEl) {
  22. yearEl.classList.add('d-none');
  23. });
  24. priceMonthlyList.map(function (monthEl) {
  25. monthEl.classList.remove('d-none');
  26. });
  27. }
  28. }
  29. // togglePrice Event Listener
  30. togglePrice();
  31. priceDurationToggler.onchange = function () {
  32. togglePrice();
  33. };
  34. })();
  35. });