Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
robbertvancaem opened this issue Jun 18, 2018 · 0 comments
Open

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

robbertvancaem opened this issue Jun 18, 2018 · 0 comments

Comments

@robbertvancaem
Copy link
Collaborator

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant