Logos DX
    Preparing search index...

    Variable classifyConst

    classify: {
        add(els: OneOrMany<Element>, names: string | string[]): void;
        has(el: Element, name: string): boolean;
        remove(els: OneOrMany<Element>, names: string | string[]): void;
        swap(els: OneOrMany<Element>, a: string, b: string): void;
        toggle(els: OneOrMany<Element>, name: string): void;
    } = ...

    Class manipulation utilities for DOM elements. Wraps classList API with support for operating on multiple elements at once.

    Type Declaration

    • add: function
      • Add one or more classes to one or many elements.

        Parameters

        Returns void

        classify.add(el, ['active', 'highlighted']);
        classify.add([el1, el2], 'visible');
    • has: function
      • Check whether a single element has a class.

        Parameters

        Returns boolean

        if (classify.has(el, 'active')) { ... }
        
    • remove: function
    • swap: function
      • Swap between two classes on one or many elements. If the element has class a, it gets b instead (and vice versa). If the element has neither, nothing happens.

        Parameters

        Returns void

        classify.swap(el, 'open', 'closed');
        
    • toggle: function
      • Toggle a class on one or many elements. Each element toggles independently based on its own state.

        Parameters

        Returns void

        classify.toggle(el, 'active');
        classify.toggle([el1, el2], 'visible');
    classify.add(el, ['active', 'highlighted']);
    classify.toggle([el1, el2], 'visible');
    classify.swap(el, 'open', 'closed');