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

Elements with position: absolute & top properties are positioned incorrectly on sticky deactivation #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

roby124
Copy link

@roby124 roby124 commented Apr 10, 2018

Elements with CSS property position set to absolute are incorrectly positioned after ng-sticky gets deactivated if top attribute is different than 0.
This is due to the fact that removeSticky() method leaves top property active on previously stickied element (only position property gets removed on deactivation - this.el.nativeElement.style.position = '';).

Example:
Element which holds ng-sticky directive has the following CSS:

position: absolute;
top: 30px;

After sticky deactivation, top property stays active and is set to 0 which places the element in a wrong place.

This pull request solves the problem by removing the whole style attribute upon sticky deactivation.

@vovank86
Copy link

vovank86 commented Jun 20, 2018

I absolutely agree with roby124. This fix is very important for me.
As temporary fix I use !important in my css, but it's wrong way.

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

Successfully merging this pull request may close these issues.

2 participants