Skip to content

Commit

Permalink
Toggle content esckey property
Browse files Browse the repository at this point in the history
  • Loading branch information
dixso committed Jan 7, 2017
1 parent 98760ee commit a9f821b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/custombox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,8 @@ describe('Custombox', () => {
content: {
effect: 'fadein',
target: '#foo-1',
},
overlay: {
escKey: false
}
},
}).open();

setTimeout(() => {
Expand Down
8 changes: 4 additions & 4 deletions src/custombox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Custombox {
color: string;
opacity: number;
close: boolean;
escKey: boolean;
active: boolean;
}

Expand All @@ -25,6 +24,7 @@ namespace Custombox {
delay: number;
id: string;
container: string;
escKey: boolean;
}

interface LoaderSchema {
Expand Down Expand Up @@ -85,7 +85,6 @@ namespace Custombox {
color: '#000',
opacity: .48,
close: true,
escKey: true,
speedIn: 300,
speedOut: 300,
onOpen: null,
Expand All @@ -110,6 +109,7 @@ namespace Custombox {
onOpen: null,
onComplete: null,
onClose: null,
escKey: true,
};
loader = {
active: true,
Expand Down Expand Up @@ -603,7 +603,7 @@ namespace Custombox {
Promise
.all(close)
.then(() => {
if (this.options.overlay.escKey) {
if (this.options.content.escKey) {
document.removeEventListener('keydown', this.action, true);
}

Expand All @@ -625,7 +625,7 @@ namespace Custombox {
}

private listeners(): void {
if (this.options.overlay.escKey) {
if (this.options.content.escKey) {
document.addEventListener('keydown', this.action, true);
}

Expand Down

0 comments on commit a9f821b

Please sign in to comment.