There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.Close
Processing...
This may take a few seconds.

trigger-real

Syntax

trigger-real: (event) [every (time)] [after (time)][, (event)...];

This command will attempt to trigger an actual JavaScript event on the target selector. The event triggered will be able to be detected external to the Active CSS environment. This is not to be confused with trigger, which only runs defined Active CSS config.

You can only run trigger-real on actual DOM elements with real JavaScript events in the config. Attempting to run a trigger-real on an element that is not there or with a custom event will result in an error.

It is less error-prone to use the "trigger" command if you want to only run Active CSS config and you don't need bubbling or an external response. But sometimes you need to run a real event on an element, and the trigger command is not enough - you need a real event.

In the example below, a JavaScript click event is trigger-real'ed for the #doSomething element when #myDiv is clicked on:

#myDiv:click {
    #doSomething {
        trigger-real: click;
    }
}

#doSomething:click {
    body {
        add-class: .test;
    }
}

Bubbling, etc. will occur if you use trigger-real.

trigger-real