Webanizr Logo
Open / sluit menu
Module cssClass

This module can add, remove or toggle css classes on multiple elements

syntax

webanizr.send('cssClass', data, parameters, callback);

data

The data is passed unaltered to the callback function. The data itself is not used.

parameters

cssClass accepts the following parameters:

name__class (required)

The name of de css class to add, remove or toggle.

query__selector (required)

The query selector to the elements to class manipulation should apply to. You can also use an DOM element as value.

type__action (optional)

The type of action that should be performed. The options are:

  • add: add given class to the selected elements
  • remove: remove the class from the select elements
  • toggle: check every element in the selection:
    • if it already has the classs: remove it
    • otherwise: add the class

callback

The callback is called directly after the manipulations and receives the data unaltered.

demo

https://cdn.cpmodules.webanizr.com/demo/css-classes/index.html