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

Issues with Vue Directive #73

Open
narcecl opened this issue Jul 21, 2020 · 1 comment
Open

Issues with Vue Directive #73

narcecl opened this issue Jul 21, 2020 · 1 comment

Comments

@narcecl
Copy link

narcecl commented Jul 21, 2020

Hi, thanks for the plugin, i've been use it from the first version with jQuery.
Now, i'm using the plugin with a Vue project with a custom directive but the 'attach' method only works once and i'd fixed including the scroll listener with the 'attach' method again.

Something like that:

let className = '.' + el.classList.value.split(' ').join('.');
const vpc = new ViewportChecker(className, {
	offset: 400,
	callbackFunction: (elem, action) => {
		binding.value();
	}
});
document.addEventListener('DOMContentLoaded', () => vpc.attach() );
document.addEventListener('scroll', () => vpc.attach() );

It works, but not always. Can you give a hand?

@narcecl
Copy link
Author

narcecl commented Jul 21, 2020

I figure it out if i have the browser console open (bottom) the function dont work.

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