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

On refresh, does not activate if not Div #246

Open
danielnr87 opened this issue Sep 11, 2017 · 2 comments
Open

On refresh, does not activate if not Div #246

danielnr87 opened this issue Sep 11, 2017 · 2 comments

Comments

@danielnr87
Copy link

danielnr87 commented Sep 11, 2017

I've noticed a strange bug where the sticky element doesn't activate if class not on a div (an <article> in my case). This only seems to affect it if the document is reloaded half way down. If the page is loaded at the very top then it is fine. Only on reload. Changed <article> to a <div> and it works fine on reload.

@ankedsgn
Copy link

ankedsgn commented Sep 26, 2017

+1,
My element needs to be sticky inside the <body>, and has the exact same problem

Recreate

  • Make an element .my-sticky-thing, that is a direct descendant of the <body>
  • $('.my-sticky-thing').stick_in_parent();
  • In chrome, open your page. Works normally.
  • In chrome, scroll your page down, and refresh
  • Element is now not sticky, (in my case appears on two spots) and has unpredictable positioning behaviour

What I expected

That after a reload halfway the page, the item would stock in the parent as before

Bonus check

On the same page we have another sticky element, in a parent div. That element behaves completely as expected.

Tried

Setting a class on the <body> and specifically defining that class as a parent didn't fix it unfortunately.

(By the way, Thank you for this script, we use it a lot and it's really handy and easy to set up!)

@carasmo
Copy link

carasmo commented Sep 28, 2017

I haven't had this issue. I think it's because I'm using https://necolas.github.io/normalize.css/7.0.0/normalize.css which turns article, nav, section, etc., into blocks.

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