Search.../

applyEffects( )

Applies one or more of an element's effects.

Description

This function applies effects that you previously defined for an element using Editor X, making the effects visible on your site.

You can find the names of the effects defined for an element using the allEffects property.

The Effects panel in Editor X has two sections, Adjust and Design, that allow you to adjust the appearance of an element or change its design characteristics. You can't simultaneously apply 2 effects that both change properties in the same section. If you try to do this, only one of the effects is visible on your site. You can, however, apply 1 effect that changes the Adjust properties and another effect that changes the Design properties simultaneously.

For example, effects for text elements allow changes to these properties:

If you create 2 effects that each change properties in the Adjust section and try to apply them together, only one is visible on your site. The same is true for 2 effects that change properties in the Design section.

Note: This function can only be used in Editor X.

Syntax

function applyEffects(effects: Array<string>): void

applyEffects Parameters

NAME
TYPE
DESCRIPTION
effects
Array<string>

The names of the effects to apply. These are the names defined when creating the effects.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Apply one of an element's effects

Copy Code
1$w('#myElement').effects.applyEffects(['My Effect']);
Apply several of an element's effects

Copy Code
1$w('#myElement').effects.applyEffects(['My Effect 1', 'My Effect 2']);
Apply one of an element's effects when a button is double-clicked

Copy Code
1$w('#myButton').onDblClick(() => {
2 $w('#myElement').effects.applyEffects(['My Effect']);
3})