ngx-scroll-to icon indicating copy to clipboard operation
ngx-scroll-to copied to clipboard

Pass function to [ngx-scroll-to-offset]

Open robbertvancaem opened this issue 6 years ago • 0 comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[ ] Documentation issue or request

Current behavior

Currently [ngx-scroll-to-offset] only supports numbers. This could be a potential problem for, let's say, a mobile layout with a fixed header. For desktop, the offset could be different than for the mobile layout. Ideally, as a user of this library, I would like to be able to pass a function to [ngx-scroll-to-offset] which gets called and returns a value for the offset

Expected behavior

<button [ngx-scroll-to-offset]="calcHeightOffset">Click</button>

The function could be something like:

@Input() calcHeightOffset = () => {
    if(mobile){
        return 80;
    }
    return 100;
}

What is the motivation / use case for changing the behavior?

See 'current behaviour'

robbertvancaem avatar Jun 18 '18 07:06 robbertvancaem