Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Does not work correctly anymore in Chrome 52 #100

Open
macrozone opened this issue Jun 15, 2016 · 4 comments
Open

Does not work correctly anymore in Chrome 52 #100

macrozone opened this issue Jun 15, 2016 · 4 comments

Comments

@macrozone
Copy link

Hi there,

The polyfill does not work correctly anymore on Chrome 52.

It starts to fix the element on top when you scroll down, but does not release it when you scroll up.

What I found out so far is that the polyfill uses jquery's css-function to get the top and bottom-values and check if these values are "auto" (see https://github.com/filamentgroup/fixed-sticky/blob/master/fixedsticky.js#L93)

the css-function of jquery uses the browsers getComputedStyle-function and this function now (correctly) returns the computed value, not the actual value that is set in the stylesheet.

So this line above (https://github.com/filamentgroup/fixed-sticky/blob/master/fixedsticky.js#L93) will always yield position = {top: true, bottom: true} .

Later isFixedToBottom will return true because of this and this leads to the problem.

I don't know how to actually fix it yet, but maybe someone has an idea.

@macrozone
Copy link
Author

ok, got a workaround:

in https://github.com/filamentgroup/fixed-sticky/blob/master/fixedsticky.js#L100 it caches the position-object (with top/bottom true or false) as data-attribute, so it is possible to declare this data-attribute in the html:

<div class="fixedsticky" data-fixed-sticky-position='{"top": true, "bottom":false}'>...

If it is present, it will skip the computation of this values.

@jorenvanhee
Copy link

Do you mean Chrome 51? That's where I'm having the issue. Chrome 52 should support position: sticky; (http://caniuse.com/#feat=css-sticky).

@macrozone
Copy link
Author

I am currently on chrome 52 beta and having this issue. position:sticky seems not to be supported yet on chrome 52 (OS X)

@iainhenderson
Copy link

iainhenderson commented Jun 20, 2016

I can see the broken behaviour in Chrome 51, 52 (Beta) and 53 (Canary), but it is still working as intended in Chrome 50 (OS X). @macrozone workaround is currently resolving the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants