Skip to content

Commit

Permalink
src: hide scrollbars after fullscreen, also consider scroll position
Browse files Browse the repository at this point in the history
  • Loading branch information
micooz committed Sep 22, 2017
1 parent c7a7e6c commit 1d44769
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/fullscreen.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import utils from './utils';

class FullScreen {
constructor (player) {
this.player = player;
Expand Down Expand Up @@ -50,6 +52,11 @@ class FullScreen {
break;
case 'web':
this.player.container.classList.add('dplayer-fulled');

// record last position then hide scrollbars
this.lastScrollPosition = utils.getScrollPosition();
document.body.classList.add('dplayer-web-fullscreen-fix');

this.player.events.trigger('webfullscreen');
break;
}
Expand All @@ -70,6 +77,11 @@ class FullScreen {
break;
case 'web':
this.player.container.classList.remove('dplayer-fulled');

// restore scrollbars and last position
document.body.classList.remove('dplayer-web-fullscreen-fix');
utils.setScrollPosition(this.lastScrollPosition);

this.player.events.trigger('webfullscreen_cancel');
break;
}
Expand Down

0 comments on commit 1d44769

Please sign in to comment.