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

Even when the affix plugin sets the 'affix' class to the affix element, it still has 'top' and 'position' attributes #12468

Closed
jtzikas opened this issue Jan 31, 2014 · 1 comment
Labels

Comments

@jtzikas
Copy link

jtzikas commented Jan 31, 2014

I have been having lots of issues with the affix plugin whith a complicated dynamic structure and I have tracked it down to line 69 in affix.js. https://github.com/twbs/bootstrap/blob/master/js/affix.js#L68

The use case is that the issue appears when the affix element transitions from affix-bottom to affix. In my case the affix plugin did not clean up the 'top' and 'position' attributes and the element was stuck floated at the affix-bottom position.

The reason is that 'this.unpin' was calculated to 0. When the value is 0 the comparison in the bellow if case is evaluated to false and the element is never cleaned up:

if (this.unpin) this.$element.css('top', '')

So I replaced it with with this block:

if (this.unpin != null) {
        this.$element.css('top', '')
        this.$element.css('position', '')
}
@cvrebert cvrebert modified the milestones: v3.2.0, v3.1.1 Feb 9, 2014
@jtzikas jtzikas closed this as completed Mar 21, 2014
@jtzikas jtzikas reopened this Mar 21, 2014
@cvrebert cvrebert removed this from the v3.2.0 milestone May 1, 2014
@cvrebert
Copy link
Collaborator

cvrebert commented May 1, 2014

Probably fixed by #12982. If not, please let us know.

@cvrebert cvrebert closed this as completed May 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants