설명 없음
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.

bs-stepper.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import Stepper from 'bs-stepper/dist/js/bs-stepper';
  2. const bsStepper = document.querySelectorAll('.bs-stepper');
  3. // Adds crossed class
  4. bsStepper.forEach(el => {
  5. el.addEventListener('show.bs-stepper', function (event) {
  6. var index = event.detail.indexStep;
  7. var numberOfSteps = el.querySelectorAll('.line').length;
  8. var line = el.querySelectorAll('.step');
  9. // The first for loop is for increasing the steps,
  10. // the second is for turning them off when going back
  11. // and the third with the if statement because the last line
  12. // can't seem to turn off when I press the first item. ¯\_(ツ)_/¯
  13. for (let i = 0; i < index; i++) {
  14. line[i].classList.add('crossed');
  15. for (let j = index; j < numberOfSteps; j++) {
  16. line[j].classList.remove('crossed');
  17. }
  18. }
  19. if (event.detail.to == 0) {
  20. for (let k = index; k < numberOfSteps; k++) {
  21. line[k].classList.remove('crossed');
  22. }
  23. line[0].classList.remove('crossed');
  24. }
  25. });
  26. });
  27. try {
  28. window.Stepper = Stepper;
  29. } catch (e) {}
  30. export { Stepper };