Closed WillMuijrers closed 9 years ago
Don't know what is going on but here is a guess:
On page load you run fixto on some elements and it works on them. Then you load some new elements, you dont run fixto on them so it does not work on them. Refresh does not adapt to new elements, it adapts to layout changes. You can try to init fixto on new elements or you can destroy the current ones and apply again on all of them.
Thanks for the quick reply!
Regrettably, that doesn't work. The console says: Uncaught TypeError: Cannot read property 'call' of undefined
or Uncaught TypeError: Cannot read property 'offsetHeight' of undefined
It looks like he cant init the callback anymore, but why?
i used both techniques in this fiddle. Seems to work.
Pressing on the buttons will add new elements and attach fixto on them.
If you prepare a fiddle of your case i could debug it.
Great plugin, love it! I'm using infinite scroll to dynamically add content to my page. When the page loads, fixTo works just fine:
// fixTo init $('article.nieuws aside').fixTo('article.nieuws', { zIndex: 10, mind: '#header', top: 60 });
After the new content is loaded by infinite scroll, the plugin stops working on the new elements. Using
refresh
orstart
doesn't work. I think this has to do with fixTo being called on the same element twice. console:Uncaught TypeError: Cannot read property 'offsetHeight' of undefined