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

Bug with parent container of height: 100 vh or 100 % #3

Closed
stefanoTron opened this issue Aug 28, 2015 · 19 comments
Closed

Bug with parent container of height: 100 vh or 100 % #3

stefanoTron opened this issue Aug 28, 2015 · 19 comments

Comments

@stefanoTron
Copy link

Hi,

In my use case I have a parent div with a height of 100 vh, this makes the animation buggy. It looks like the 'scroll' event is not fired, so on page load the animation looks good and on resize it works as well. If I remove the 100 vh, everything is back to normal. Same thing happens with 100%.

@rpocklin
Copy link
Owner

not sure what 100vh means but if you send me a plukr or code I can take a look.

@stefanoTron
Copy link
Author

I'll setup a plnkr shortly, in the mean time check out http://www.w3.org/TR/css3-values/#viewport-relative-lengths for the viewport percentage unit.

@stefanoTron
Copy link
Author

here you go: http://plnkr.co/edit/kRtMO3mzwKFI3YwkNFyA?p=preview

I noticed that using flexbox also seams to be part of the problem.

So to summerize:
flexbox + 100vh --> buggy
flexbox + 100% --> buggy
just 100vh without flexbox --> ok
flexbox with pixel height (say 1000px) or auto --> ok

hope this helps :)

@Ross-Rawlins
Copy link

I have given it a set height and it still doenst run the animate element function. It only runs it on load. Please help. If I resize the browser window then it picks up teh event and animates the items.

@umdstu
Copy link

umdstu commented Nov 3, 2015

I think I'm experiencing the same issue. Things seem to work fine until they are scrolled back into view, in which case they do not animate back in. Adding some log statements it's clear that when-visible function is not even firing when the elements are scrolled back into view after having been hidden. Using this bootstrap.

@rpocklin
Copy link
Owner

rpocklin commented Nov 3, 2015

Haven't had time to debug this yet, but i'm expecting either the getBoundingClientRect() doesn't play nice with those CSS settings or the calculations don't work as expected in those cases.

Armed with the plunkr, i'll take a look in the next few days.

@rpocklin
Copy link
Owner

rpocklin commented Nov 4, 2015

Problem appears to be the DOM not triggering 'scroll' events when. Culprit is overflow: auto with flexbox and vh (every other combination works in Chrome).

Biggest issue is it is browser specific, Chrome works one way, Safari works another. Need to investigate more to have a global solution.

@Ross-Rawlins
Copy link

Thanks for doing this fix. I would like to use it on a production app so if you find the bug in time it would be awesome.

@rpocklin
Copy link
Owner

rpocklin commented Nov 4, 2015

Check out v0.9.8 and specify the bind-scroll-to documentation, this should fix it cross-browser.

@Ross-Rawlins
Copy link

I just downloaded it and its not working still...still the same thing where it doesnt update on scroll. I am using it in IONIC and with angular material with no luck,

@rpocklin
Copy link
Owner

rpocklin commented Nov 4, 2015

You will need to be more specific, ie. what css styles and structure you are using. Which browsers are you using?

@Ross-Rawlins
Copy link

I am using chrome. And the height is set using 100%; no auto

@rpocklin
Copy link
Owner

rpocklin commented Nov 4, 2015

Rather than me guessing your HTML structure and css classes, perhaps you can provide them and I can offer help. Plunkr is good here.

@rpocklin
Copy link
Owner

rpocklin commented Nov 4, 2015

@littletower here is your plunkr, with v0.9.8 of this directive and bind-scroll-to specified, which fixes the issue. http://plnkr.co/edit/vW7oan30HIPjqpe4OOEq?p=preview

@rpocklin rpocklin closed this as completed Nov 4, 2015
@stefanoTron
Copy link
Author

thanks! works fine for me.

@Ross-Rawlins
Copy link

I still cant get it to work, what am I doing wrong here?
screen shot 2015-11-05 at 8 51 06 am

@rpocklin
Copy link
Owner

rpocklin commented Nov 6, 2015

@Duovili your bind-scroll-to should be a parent element of timeline not a child element.

@Ross-Rawlins
Copy link

thanks that solved it. and thank you for being so quick to respond.

@SylTi
Copy link

SylTi commented Feb 3, 2016

I have the same problem. I use flexbox, and your solution doesn't seems to work.
My structure looks like that :
html :
`

`

Js :
` var vm = this;

vm.animateElementIn = animateElementIn;
    vm.animateElementOut = animateElementOut;

    function animateElementIn($el) {
        console.log('animeIn');
        $el.removeClass('hidden');
        $el.addClass('animated slideInLeft'); 
    };

    function animateElementOut($el) {
        console.log('animeOut');
        $el.addClass('hidden');
        $el.removeClass('animated slideInLeft');
    };`

The callbacks never get fired.
Any idea ? Thanks in advance.

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

5 participants