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

How to use it with import #1

Closed
Colir opened this issue Sep 13, 2024 · 3 comments
Closed

How to use it with import #1

Colir opened this issue Sep 13, 2024 · 3 comments
Assignees
Labels
good first issue Good for newcomers info-needed More information is needed. question Further information is requested

Comments

@Colir
Copy link

Colir commented Sep 13, 2024

Hi, i think I'm dummy,
but I can't figure how the polyfill works.

here is my code

`
import scrollend from 'scrollend-polyfill';

export default function(){

window.addEventListener('click', (e) => {
    if( e.target.classList.contains('preventStickyNavShow') ){
        cancelStickyNavShow = true;
        document.addEventListener("scrollend", (evt) => {
                console.log("done scrolling");
                cancelStickyNavShow = false;
            },{ once: true });
         
    }  
})

}
`
But this has no effect in Safari (this browser doesn't support the native scrollend event)
I've also tried window.addEventListener('scrollend') without success.

I'm missing out on how to init the polyfill.

Can you help me.
Thank you

@igorskyflyer
Copy link
Owner

Hello @Colir, thank you for taking an interest in using my scrollend polyfill.

In order to provide you with some tips and fix(es), could you please provide me with the full source code of the page using it or a repository so I can pinpoint the exact issue.

Thanks. 😁

@igorskyflyer igorskyflyer self-assigned this Sep 14, 2024
@igorskyflyer igorskyflyer added good first issue Good for newcomers question Further information is requested info-needed More information is needed. labels Sep 14, 2024
@Colir
Copy link
Author

Colir commented Sep 16, 2024

Hi @igorskyflyer ,
Sorry, I found the problem:
the import must be done with
import scrollend from '@igor.dvlpr/scrollend-polyfill';
and not
import scrollend from 'scrollend-polyfill';
Everything's working fine now, thanks.

@igorskyflyer
Copy link
Owner

Hi @igorskyflyer ,
Sorry, I found the problem:
the import must be done with
import scrollend from '@igor.dvlpr/scrollend-polyfill';
and not
import scrollend from 'scrollend-polyfill';
Everything's working fine now, thanks.

Got it, yes, there are multiple ways of importing the polyfill depending on your environment's setup and workflow. I just wanted to check everything. Glad you figured it out yourself, nice work. 😁

And thanks for confirming that it works properly in Safari, I have done only limited tests in it.

If the issue is resolved we can close it now and if you have any other issue(s), don't hesitate to open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers info-needed More information is needed. question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants