tax-toggle.js 587 B

123456789101112131415161718192021222324252627
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'jquery'
  7. ], function ($) {
  8. 'use strict';
  9. /**
  10. * @param {Object} config
  11. * @param {jQuery.Event} e
  12. */
  13. function onToggle(config, e) {
  14. var elem = $(e.currentTarget),
  15. expandedClassName = config.expandedClassName || 'cart-tax-total-expanded';
  16. elem.toggleClass(expandedClassName);
  17. $(config.itemTaxId).toggle();
  18. }
  19. return function (data, el) {
  20. $(el).on('click', onToggle.bind(null, data));
  21. };
  22. });