Closed bpierre closed 12 years ago
I forgot to precise that I call the constructor as a function, but the CSS / Scrollbars part of the constructor could be moved in another method.
Is there a reason we need to cache the styles of inner
?
It’s a precaution, in order to reset the styles to their previous values before calling the Antiscroll constructor.
If we replace it with inner.attr('style', '')
:
var containers = $('.container');
containers.find('.antiscroll-inner').css('background', 'red'); // The background is red
containers.antiscroll();
containers.each(function(){
$(this).data('antiscroll').rebuild(); // The red background is removed
});
But if we assume that:
<div class="antiscroll-inner">
is supposed to be dedicated to antiscrollantiscroll()
and rebuild()
, and will not be cachedI think it’s relatively safe to remove it. I will add another commit.
Useful for containers without explicit dimensions, e.g. :