vue-scrollmonitor
vue-scrollmonitor copied to clipboard
Incorrect docs for container prop
The docs say that the container prop is a DOM element, and that the ScrollContainer will use that element to watch for scrolling. In the actual code, it appears that the container prop is actually a boolean. Default is false and it listens for scrolls on the document body. If container is true, it just uses the ScollContainer component itself, which is a div (this.$el).
Looks like there's also an open PR related to this
So, instead of
<div class="my-container>
<scroll-container :container="MyContainerDivDomElement">
// ... items ...
</scroll-container>
</div>
The correct way to use a custom container with the current version of this package is:
<scroll-container class="my-container" :container="true">
// ... items ...
</scroll-container>
I prefer it this way, but the API docs are misleading right now.