ibufu / vue2-scrollspy

Scrollspy for Vue2
https://ibufu.github.io/vue2-scrollspy/
MIT License
135 stars 32 forks source link

Events (active item changed) #46

Closed fhnb16 closed 2 years ago

fhnb16 commented 2 years ago

How to trigger function if active element changed? This library has events? I have a long menu list with scroll (div with overflow) and want to make autoscroll following Active item..

fhnb16 commented 2 years ago

Sorry for stupid question, find solution: v-scroll-spy="{data: 'section'}" than

watch:
        {
            'section': function ()
            {
                document.querySelector(' /* my list div */ ').scrollTop = document.querySelector(' /* list item with active class */ ').offsetTop-128; 
            }
        }