Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 9032da8

Browse files
serhiyzhovnirjeff-matthews
authored andcommitted
Add code examples of adding callbacks on the collapsible widget events (#4552)
* Add code examples of adding callbacks on collapsible widget events * Add editorial suggestions
1 parent b4a39f7 commit 9032da8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

guides/v2.1/javascript-dev-guide/widgets/widget_collapsible.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,32 @@ $("#element").collapsible("forceDeactivate");
513513
### `beforeOpen callback` {#c_beforeOpen}
514514
Called before the content is opened.
515515

516+
Example of adding a callback to `beforeOpen` events:
517+
518+
```javascript
519+
$("#element").on("beforeOpen", function () {
520+
// do something before opening the content
521+
});
522+
```
523+
516524
### `dimensionsChanged` {#c_dimensionsChanged}
517525
Called after content is opened or closed.
518526

527+
Example of adding a callback to `dimensionsChanged` events:
528+
529+
```javascript
530+
$("#element").on("dimensionsChanged", function (event, data) {
531+
var opened = data.opened;
532+
533+
if (opened) {
534+
// do something when the content is opened
535+
return;
536+
}
537+
538+
// do something when the content is closed
539+
});
540+
```
541+
519542
#### Code sample
520543

521544
The following example shows how to initialize the collapsible widget and pass options during the initialization.

0 commit comments

Comments
 (0)