Sha256: b0a7cff376d3b17a46958157854418b2c75bdab23a3af01e2a0c3ae8b771c43d

Contents?: true

Size: 647 Bytes

Versions: 1

Compression:

Stored size: 647 Bytes

Contents

'use strict'; 

const questions = () => {

  const CONTAINER_ID = "container";
  const CLASS_NAME = "scroll-form__questionset";
  const ACTIVE_CLASS = "scroll-form__questionset--active";

  return {
    getContainer: () => document.getElementById(CONTAINER_ID),
    getQuestion: (index) => document.getElementsByClassName(CLASS_NAME)[index],
    setActiveQuestion: function(index) {
      const questionList = [].slice.call(document.getElementsByClassName(CLASS_NAME));
      questionList.forEach((elm) => elm.classList.remove(ACTIVE_CLASS));
      this.getQuestion(index).classList.add(ACTIVE_CLASS);
    }
  };
};

module.exports = questions();

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dta_rapid-0.3.3 assets/js/questions.js