Search.../

removeAllEffects( )

Removes all of an element's applied effects.

Description

This function removes all of an element's previously applied effects. Once you remove effects, they're unapplied from an element and no longer visible on your site.

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

Syntax

function removeAllEffects(): void

removeAllEffects Parameters

This function does not take any parameters.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Remove all of an element's applied effects

Copy Code
1$w('#myElement').effects.removeAllEffects();
Remove one applied effect on button click and all applied effects on double click

This example uses different event handlers to control element effects.

The code assigns 2 event handlers to the same button. When the button is clicked once, the specified element's most recently applied effect is removed. When the button is double clicked, all the element's applied effects are removed.

Copy Code
1// Remove the most recently added effect on single click.
2$w('#myButton').onClick(() => {
3 const activeEffects = $w('#myElement').effects.activeEffects;
4 if(activeEffects.length > 0){
5 $w('#myElement').effects.removeEffects([activeEffects[activeEffects.length - 1]]);
6 }
7});
8
9// Remove all effects on double click
10$w('#myButton').onDblClick(() => {
11 $w('#myElement').effects.removeAllEffects();
12});