Skip to content

Commit

Permalink
Ink.Ui.Modal - Adds an option to prevent page scrolling while the mod…
Browse files Browse the repository at this point in the history
…al window is open.
  • Loading branch information
Pedro Correia committed Apr 7, 2016
1 parent b01bd7d commit d642c9f
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 16 deletions.
15 changes: 13 additions & 2 deletions dist/js/ink-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -21009,7 +21009,8 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
onDismiss: ['Function', undefined],
closeOnClick: ['Boolean', false],
closeOnEscape: ['Boolean', true],
responsive: ['Boolean', true]
responsive: ['Boolean', true],
preventPageScroll: ['Boolean',false]
};

Modal.prototype = {
Expand Down Expand Up @@ -21432,7 +21433,11 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
this._isOpen = true;
openModals.push(this);

Css.addClassName(document.documentElement, 'ink-modal-open');
if (this._options.preventPageScroll === true) {
Css.setStyle(document.body,'position: fixed');
}

Css.addClassName(document.documentElement, 'ink-modal-open');
},

/**
Expand Down Expand Up @@ -21488,7 +21493,13 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
var htmlEl = document.documentElement;

// Remove the class from the HTML element.


if (this._options.preventPageScroll === true) {
document.body.style.position = '';
}
Css.removeClassName(htmlEl, 'ink-modal-open');

}
},

Expand Down
4 changes: 2 additions & 2 deletions dist/js/ink-all.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/ink-all.min.js.map

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions dist/js/ink-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -7689,7 +7689,8 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
onDismiss: ['Function', undefined],
closeOnClick: ['Boolean', false],
closeOnEscape: ['Boolean', true],
responsive: ['Boolean', true]
responsive: ['Boolean', true],
preventPageScroll: ['Boolean',false]
};

Modal.prototype = {
Expand Down Expand Up @@ -8112,7 +8113,11 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
this._isOpen = true;
openModals.push(this);

Css.addClassName(document.documentElement, 'ink-modal-open');
if (this._options.preventPageScroll === true) {
Css.setStyle(document.body,'position: fixed');
}

Css.addClassName(document.documentElement, 'ink-modal-open');
},

/**
Expand Down Expand Up @@ -8168,7 +8173,13 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
var htmlEl = document.documentElement;

// Remove the class from the HTML element.


if (this._options.preventPageScroll === true) {
document.body.style.position = '';
}
Css.removeClassName(htmlEl, 'ink-modal-open');

}
},

Expand Down
8 changes: 4 additions & 4 deletions dist/js/ink-ui.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/ink-ui.min.js.map

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions dist/js/ink.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
onDismiss: ['Function', undefined],
closeOnClick: ['Boolean', false],
closeOnEscape: ['Boolean', true],
responsive: ['Boolean', true]
responsive: ['Boolean', true],
preventPageScroll: ['Boolean',false]
};

Modal.prototype = {
Expand Down Expand Up @@ -541,7 +542,11 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
this._isOpen = true;
openModals.push(this);

Css.addClassName(document.documentElement, 'ink-modal-open');
if (this._options.preventPageScroll === true) {
Css.setStyle(document.body,'position: fixed');
}

Css.addClassName(document.documentElement, 'ink-modal-open');
},

/**
Expand Down Expand Up @@ -597,7 +602,13 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
var htmlEl = document.documentElement;

// Remove the class from the HTML element.


if (this._options.preventPageScroll === true) {
document.body.style.position = '';
}
Css.removeClassName(htmlEl, 'ink-modal-open');

}
},

Expand Down
15 changes: 13 additions & 2 deletions src/js/Ink/UI/Modal/1/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
onDismiss: ['Function', undefined],
closeOnClick: ['Boolean', false],
closeOnEscape: ['Boolean', true],
responsive: ['Boolean', true]
responsive: ['Boolean', true],
preventPageScroll: ['Boolean',false]
};

Modal.prototype = {
Expand Down Expand Up @@ -541,7 +542,11 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
this._isOpen = true;
openModals.push(this);

Css.addClassName(document.documentElement, 'ink-modal-open');
if (this._options.preventPageScroll === true) {
Css.setStyle(document.body,'position: fixed');
}

Css.addClassName(document.documentElement, 'ink-modal-open');
},

/**
Expand Down Expand Up @@ -597,7 +602,13 @@ Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.
var htmlEl = document.documentElement;

// Remove the class from the HTML element.


if (this._options.preventPageScroll === true) {
document.body.style.position = '';
}
Css.removeClassName(htmlEl, 'ink-modal-open');

}
},

Expand Down

0 comments on commit d642c9f

Please sign in to comment.