Hide scrollbars only when updated manually.

Resolve #283.
This commit is contained in:
Hyunje Alex Jun 2015-02-17 01:46:13 +00:00
parent a12def5213
commit b4a51fc454
2 changed files with 11 additions and 11 deletions

View File

@ -55,10 +55,6 @@ function updateCss(element, i) {
module.exports = function (element) { module.exports = function (element) {
var i = instances.get(element); var i = instances.get(element);
// Hide scrollbars not to affect scrollWidth and scrollHeight
cls.remove(element, 'ps-active-x');
cls.remove(element, 'ps-active-y');
i.containerWidth = element.clientWidth; i.containerWidth = element.clientWidth;
i.containerHeight = element.clientHeight; i.containerHeight = element.clientHeight;
i.contentWidth = element.scrollWidth; i.contentWidth = element.scrollWidth;
@ -97,10 +93,6 @@ module.exports = function (element) {
updateCss(element, i); updateCss(element, i);
if (i.scrollbarXActive) { cls[i.scrollbarXActive ? 'add' : 'remove'](element, 'ps-active-x');
cls.add(element, 'ps-active-x'); cls[i.scrollbarYActive ? 'add' : 'remove'](element, 'ps-active-y');
}
if (i.scrollbarYActive) {
cls.add(element, 'ps-active-y');
}
}; };

View File

@ -3,7 +3,8 @@
*/ */
'use strict'; 'use strict';
var destroy = require('./destroy') var d = require('../lib/dom')
, destroy = require('./destroy')
, initialize = require('./initialize') , initialize = require('./initialize')
, instances = require('./instances') , instances = require('./instances')
, updateGeometry = require('./update-geometry'); , updateGeometry = require('./update-geometry');
@ -17,6 +18,13 @@ module.exports = function (element) {
destroy(element); destroy(element);
initialize(element); initialize(element);
} else { } else {
// Hide scrollbars not to affect scrollWidth and scrollHeight
d.css(i.scrollbarXRail, 'display', 'none');
d.css(i.scrollbarYRail, 'display', 'none');
updateGeometry(element); updateGeometry(element);
d.css(i.scrollbarXRail, 'display', 'block');
d.css(i.scrollbarYRail, 'display', 'block');
} }
}; };