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

Trigger animation on element visible #33

Open
andylacko opened this issue Jun 22, 2016 · 0 comments
Open

Trigger animation on element visible #33

andylacko opened this issue Jun 22, 2016 · 0 comments

Comments

@andylacko
Copy link

Hello, it seems nice, but I have to know, if there is option animate element only after it appeared on screen. Didn't check the code properly, but didn't find any function enabling it in documentation.

something like this:
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();

return rect.bottom > 0 &&
    rect.right > 0 &&
    rect.left < (window.innerWidth || document. documentElement.clientWidth) /*or $(window).width() */ &&
    rect.top < (window.innerHeight || document. documentElement.clientHeight) /*or $(window).height() */;

}

because I think it would be nice, because if it is not implemented, user usualy see only top animations, I created my lib, it is not so elaborated, so I was lucky to find yours, here is mine:

https://github.com/andylaci/animate-visible

It doesn't have callbacks, but delay does the job, you can take the best things from mine and improve yours ;)

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