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

When content of parallax expands the height of the mirror does not expand smoothly #39

Closed
David-Gallimore opened this issue Mar 5, 2015 · 4 comments

Comments

@David-Gallimore
Copy link

I have a parallax with divs inside that use slideToggle.

I am mimicing the window being resized to trigger a refresh of the parallax height.

The height of the parallax changes but no way of making it smooth as it is triggered after the slideToggle has completed.

Thanks

@David-Gallimore David-Gallimore changed the title When content of parallax expands the height of the mirror does not When content of parallax expands the height of the mirror does not expand smoothly Mar 5, 2015
@mikegreiling
Copy link
Member

jQuery(window).trigger('resize').trigger('scroll');

@David-Gallimore
Copy link
Author

Hi Mike,

Thanks for your quick reply. However it did not help, I am currently doing the below:

$(this).prev('div.wrap-infos').slideToggle(function(){
            window.dispatchEvent(new Event('resize'));

});

Which works but the height is only changed after the divs have increased in size and so doesn't flow with the toggle slide.

Thanks

@mikegreiling
Copy link
Member

Ah, I see.

Unfortunately there is no simple way of achieving what you want. The plugin's 'resize' hook was meant to cover a content refresh in a single frame (e.g. when the user resizes the browser window or in response to a single, layout-changing DOM manipulation).

You could try to create a manual 'step' method for jQuery.animate() and place the trigger there, but I worry it would have pretty poor performance on older browsers since it would be recalculating every parallax element at every frame of the animation. Let me know how it works for you if you decide to give it a try...

@wstoettinger
Copy link
Collaborator

closed antiquated issue for cleanup. if this is still rellevant, feel free to reopen.

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

3 participants