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

Fixed elements are not behaving as such after page transition #370

Open
warudin opened this issue Aug 6, 2018 · 4 comments
Open

Fixed elements are not behaving as such after page transition #370

warudin opened this issue Aug 6, 2018 · 4 comments

Comments

@warudin
Copy link

warudin commented Aug 6, 2018

Hi,

I've got some fixed elements on a website in which I'm trying to integrate smoothState.js. I noticed that elements that have position: fixed; are not sticky anymore after a pageload, they seem relatively positioned afterwards although they are still marked as sticky in the debugger.

Is this a known problem or could there be something wrong in my code?

jQuery(function() {
	'use strict';
	var options = {
			prefetch: true,
			cacheLength: 2,
			blacklist: '.gform_wrapper *',
			onStart: {
				duration: 250, // Duration of our animation
				render: function($container) {
					// Add your CSS animation reversing class
					$container.removeClass('fadeInRight');
					$container.addClass('is-exiting animated fadeOutRight');


					// Restart your animation
					smoothState.restartCSSAnimations();
				}
			},
			onReady: {
				duration: 0,
				render: function($container, $newContent) {
					// Remove your CSS animation reversing class
					$container.removeClass('is-exiting fadeOutRight');
					$container.addClass('fadeInRight');

					// Inject the new content
					$container.html($newContent);

					jQuery(window).trigger('ready');
				}
			},
			onAfter: function($container) {
				console.log('onAfter');
				loadFunctions();
				// jQuery(window).trigger('load');
			},
		},
		smoothState = jQuery('#content-wrapper').smoothState(options).data('smoothState');
});
@hentrev
Copy link

hentrev commented Oct 24, 2018

+1

@shaunw
Copy link

shaunw commented Feb 3, 2019

ever figure this out?

@warudin
Copy link
Author

warudin commented Feb 4, 2019

Unfortunately: no. I stopped using smoothState because I couldn't find a solution for this.

@LazyDevStudio
Copy link

LazyDevStudio commented Dec 10, 2019

Any element with position:fixed will lose its positioning if you apply a transform to any of its ancestors, which is probably what your FadeInRight animation does when you transition pages in and out. Remove the transform property from its parents and the fixed element will stay fixed.

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