Skip to content

Commit

Permalink
✨ New and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordy committed Jan 31, 2023
1 parent 5d0524b commit 1e82209
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 13 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ Some additional attributes are available to allow both of those cases, overridin

Some methods are available, to turn on/off Cartapus programmatically :

### `.add(el)`

Cartapus watches DOM changes and observes automatically appended elements. But in some cases you may need to start observing an element manually (when a `data-cartapus` attribute has been added after the element being appended,etc).

This method returns `true` if the element is now being watched, `false` if not.

### `.triggerEvents(targets)`

Triggers instantly the cartapus events related to the given elements (can be an array of elements, or a single element).

If `targets` parameter is not given, it triggers the events of **all** observed elements.

### `.destroy()`

Stops observing **all** `[data-cartapus]` elements. And disconnects all the `IntersectionObservers` along with the `MutationObserver`.
Expand Down
2 changes: 1 addition & 1 deletion bundled/cartapus.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1e82209

Please sign in to comment.