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
Revealing large images causes odd behavior? #462
Comments
I added |
ScrollReveal 4 adds Did you solve this @camsarmiento ? |
Not at all, I'be trying different stuff but it's been quite a mission, is there something else I can do ? |
Looking further into it, weirdly if the width of the window is smaller than a certain amount it stops working. However, bigger screen and it starts working again. Below is a gif of what happened to me. From my experimentation, it might be a styling issue. However, I will look further. [need to fix link] EDIT: After further investigation, it looks like it starts working when the window is resized width wise and not the css change. It seems to be only happening in webkit browsers. I'll keep experimenting. @jlmakes @camsarmiento Have you tried viewing the webpage in a browser like Edge or Internet Explorer? It seems to work fine in those browsers. EDIT2: I'm getting conflicting results, but it seems the only browser it doesn't work in is Chrome for me. |
I had the same problem with my website, I called the sync function using the For example : sr.reveal('#search', {
beforeReset: function(){
sr.sync()
},
reset: true
}); |
Otherwise, replace : |
I'm noticing in both examples, there are rather large images being revealed. It's starting to sound like ScrollReveal is being initialized before these large images have finished loading. If that were true, then the element dimensions could be incorrect, making elements reveal/reset at unexpected times— and explain why calling @camsarmiento try wrapping your ScrollReveal code in a window.addEventListener('load', function() {
ScrollReveal().reveal('.items');
}); |
In my case, it is a slider (set of images) and it takes much time to be loaded than other elements. This issue occurs only when reset is triggered (reveal works fine). |
See jlmakes/scrollreveal#462 Update from ScrollReveal v4.0.0 to v4.0.4
Any updates @camsarmiento @johnphilosopher ? |
I can't really seem to come to a definitive conclusion as seemingly resizing the browser window in chrome fixes the problem, while it works properly in other browsers. I admittedly haven't tested much else after, but I'll look into it more. |
I really appreciate your help @johnphilosopher
There's enough evidence in this thread, that I'm almost certain the problem is that large images are passed to ScrollReveal before they have finished loading. ScrollReveal caches element dimensions for faster Element dimensions are essential to reveal logic, so it's important that large images be given time to finish loading and assume their proper dimensions. (This was why I suggested using ScrollReveal on large images inside a window This whole situation can be avoided by:
|
I agree with @jlmakes, is the responsibility of the developer to be aware of these image loading inconsistencies. Other libraries like scroll-to-element that rely on element position will also fail, because of the same problem |
Hey I'm using scroll reveal v4 at this website http://camilomancilla.com.co/AGR.html but without reason stopped working, when scroll down shows the items for a while but then the items hide again as quick as I keep scrolling down, I've been searching about this bug but there isn't any case about this... Help me!!!
Environment
The text was updated successfully, but these errors were encountered: