var _mql = new Dictionary();
var _scrollDisableCounter = 0;
+ var _scrollOffsetFrom;
var _mqMap = Dictionary.fromObject({
'screen-xs': '(max-width: 544px)', /* smartphone */
*/
scrollDisable: function() {
if (_scrollDisableCounter === 0) {
+ var h = document.body.scrollTop;
+ _scrollOffsetFrom = 'body';
+ if (!h) {
+ h = document.documentElement.scrollTop;
+ _scrollOffsetFrom = 'documentElement';
+ }
+
+ elById('pageContainer').style.setProperty('transform', 'translateY(-' + h + 'px)');
document.documentElement.classList.add('disableScrolling');
}
if (_scrollDisableCounter === 0) {
document.documentElement.classList.remove('disableScrolling');
+ var h = elById('pageContainer').style.getPropertyValue('transform').match(/translateY\(-(\d+)px\)/);
+ elById('pageContainer').style.removeProperty('transform');
+ if (h) {
+ document[_scrollOffsetFrom].scrollTop = ~~h[1];
+ }
}
}
},