Open madcapnmckay opened 12 years ago
I believe what happened here is that destroy() method forget to clean up scrollbar variable
I don't have git with me at the moment, but try this destroy() method
Antiscroll.prototype.destroy = function () {
if (this.horizontal) {
this.horizontal.destroy();
this.horizontal = null
}
if (this.vertical) {
this.vertical.destroy();
this.vertical = null
}
return this;
};
I am using this workaround, I just tested it on IE8, this seems to to do the job, it could probably be encapsulated inside the lib
// on resize ...
// reset size of wrapper and inner, you can probably do the same for height if you do horizontal scroll
scroller.inner.width('auto');
scroller.el.width('auto');
// resize it again
// I updated antiscroll to expose the scrollbarbarsize and reuse it here
scroller.el.width(w = this.scroller.el.width());
scroller.inner.width(w + this.scroller.scrollbarSize);
Using both @madcapnmckay 's and @bitinn 's modifications above, I'm having success with the following code on a resize:
scroller.destroy().refresh();
Is there a documented 'correct' way to refresh the antiscroll? I have various things like window resize, adding elements to the container and loading this via ajax that all require the antiscroll to be destroyed and reapplied and I can't work out which method I should be using.
Bump
I was having trouble with rebuild as used in Addepar/ember-table. Horizontal scrolling after content resize sometimes results in an inability to scroll all the way to the right to see the rightmost content. From my tests this seems to be true with vanilla usage of antiscroll rather than something incorrect in ember-table.
Changing the way the antiscroll-inner div is sized solved it for me and the usage of rebuild
then worked as expected.
See Addepar/ember-table#249 for details.
Hi,
My container is 100% height. I am handling the window resize to update the scroller. All three potential methods I've tried have issues.
Here is a gist that demonstrates the issue.
https://gist.github.com/2522897
The methods I've tried to get this to work
I'm not sure why the plugin has both a rebuild and a refresh method? From reading the previous issues it seems rebuild was meant to solve the issue of flexible containers. I have an alternative fix which doesn't require the rebuild method.
I simply update the inner size in the refresh method. This step can then be removed from the constructor. Works great for me. Maybe I am missing the reason for the rebuild method.
Thanks