Skip to content

Callbacks #46

@joaqib

Description

@joaqib

Hi tsuyoshiwada,

First of all thanks for the project because it seems amazing.
The problem I am encountering is that I am not able to create callbacks functions for the scroll.
The example option is in typescript but even if I change it to Plain JS and pass the object as the options, it does not work for me.

I just convert this code into JS and the console.log does not execute before the scrolls

`const scroller = new SweetScroll({

// Stop scrolling case of trigger element that contains the is-disabled class.
before: (offset: Offset, $trigger: Element | null, scroller: SweetScroll): boolean | void => {
console.log('Before!!', offset, scroller);
if ($trigger && $trigger.classList.contains('is-disabled')) {
return false;
}
},
});`

I have search Github for code using the callbacks of the sweet-scroll library without any success.
I hope this does not bother as I feel is more my fault than yours but I am in a complete roadblock.

Thanks for everything in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions