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('resize').trigger('scroll') not working #287

Open
matmartinstudio opened this issue Aug 29, 2019 · 3 comments
Open

.trigger('resize').trigger('scroll') not working #287

matmartinstudio opened this issue Aug 29, 2019 · 3 comments

Comments

@matmartinstudio
Copy link

matmartinstudio commented Aug 29, 2019

With ref to https://github.com/pixelcog/parallax.js#notes, I am finding it impossible to trigger a resize event in order to re-position images in parallax divs. I am having this issue on several sites – it can be seen currently at this site (scroll down to "Past Events", click on "Load More" and check image in div below).

I'm adding $(window).trigger('resize').trigger('scroll'); to the click event in the site footer and checking it with a console.log that's returning as expected. But the resize is doing nothing.

I should add that adding a slight delay to the whole, like this makes no difference:

setTimeout(function(){ $(window).trigger('resize').trigger('scroll'); }, 500);

Am I implementing this incorrectly?

Thanks.

@felix-bohlin
Copy link

Same. If I resize manually the image looks good, but not when I scroll. Adding the trigger events doesn't make a difference.

@silviapeveri
Copy link

Did anyone find a way to solve it? Resize works perfectly but I have te same problem on scroll.

@woif00
Copy link

woif00 commented Jun 6, 2022

Had the same problem, fixed it by using the vanilla JS version:
window.dispatchEvent(new Event('resize'));

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

4 participants