Function cycleCssClass

Given an array of class class names, this will cycle between them each time it is called.

Eg, assume list is: [ a, b, c ]

If el already has the class a, the first time it is called, class a is removed, and b added. The next time b is swapped for c. Once again, c will swap with a and so on.

If el is undefined or null, function silently returns.

  • Parameters

    • el: Readonly<HTMLElement>

      Element

    • list: readonly string[]

      List of class names

    Returns void