Skip to content

Commit

Permalink
Bug fix fullscreen method (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
dixso committed May 20, 2017
1 parent d840b22 commit 1b9ae2d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = function(grunt) {
' * babel-plugin-transform-object-assign - https://www.npmjs.com/package/babel-plugin-transform-object-assign\n' +
' * es6-promise - https://www.npmjs.com/package/es6-promise\n' +
' * custom-event-polyfill - https://www.npmjs.com/package/custom-event-polyfill\n' +
' * fullscreen-api-polyfill - https://www.npmjs.com/package/fullscreen-api-polyfill\n' +
' *\n' +
'<%= License %>',

Expand Down Expand Up @@ -73,6 +74,7 @@ module.exports = function(grunt) {
'./node_modules/babel-polyfill/dist/polyfill.min.js',
'./node_modules/custom-event-polyfill/custom-event-polyfill.js',
'./node_modules/es6-promise/dist/es6-promise.auto.min.js',
'./node_modules/fullscreen-api-polyfill/fullscreen-api-polyfill.min.js',
],
dest: 'dist/built/custombox.legacy.min.js',
},
Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
"devDependencies": {
"@types/core-js": "^0.9.41",
"@types/jasmine": "^2.5.38",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.18.0",
"custom-event-polyfill": "^0.3.0",
"es6-promise": "^4.0.5",
"grunt": "^1.0.1",
"grunt-autoprefixer": "^3.0.4",
"grunt-babel": "^6.0.0",
Expand Down Expand Up @@ -68,5 +63,13 @@
"test": "npm run lint && karma start karma.conf.js --single-run",
"tslint": "tslint",
"watch:test": "karma start karma.conf.js"
},
"dependencies": {
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"custom-event-polyfill": "^0.3.0",
"es6-promise": "^4.1.0",
"fullscreen-api-polyfill": "^1.1.2"
}
}
11 changes: 11 additions & 0 deletions src/custombox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,17 @@ namespace Custombox {
}

private listeners(): void {
const AFM = window.getComputedStyle(this.content.element).getPropertyValue('animation-fill-mode');

document.addEventListener('fullscreenchange', () => {
const style = window.getComputedStyle(this.content.element);
if (style.getPropertyValue('animation-fill-mode') === AFM) {
this.content.element.style.animationFillMode = 'backwards';
} else {
this.content.element.style.animationFillMode = AFM;
}
}, true);

if (this.options.content.close) {
document.addEventListener('keydown', this.action, true);
}
Expand Down

0 comments on commit 1b9ae2d

Please sign in to comment.