Skip to content

Commit aeb6a79

Browse files
author
Masashi Hirano
committed
fix preview position on fullscreen
1 parent 2dfb43d commit aeb6a79

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

demo/slideshow.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,14 @@ var SlideShow = function (_React$Component) {
356356
key: key
357357
});
358358
});
359-
var fullscreenBottom = document.mozFullScreen ? 180 : 120;
359+
var fullscreenBottom = 120;
360+
var wrapper = document.querySelector('.slideshow-wrapper');
361+
var content = document.querySelector('.content');
362+
var progressBar = document.querySelector('.progressBar');
363+
var bar = document.querySelector('.bar');
364+
if (wrapper && content && progressBar && bar) {
365+
fullscreenBottom = window.screen.availHeight - content.offsetHeight + progressBar.offsetHeight + bar.offsetHeight + 10;
366+
}
360367
var bottom = _this.state.isFullScreen ? fullscreenBottom : _Styles.Styles.PREVIEW.bottom;
361368
var STYLE = _extends({}, _Styles.Styles.PREVIEW, {
362369
opacity: _this.state.preview,

lib/SlideShow.js

+9-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-slideshow-ui",
3-
"version": "0.3.4",
3+
"version": "0.3.5",
44
"author": "Masashi Hirano (https://github.com/shisama)",
55
"license": "MIT",
66
"description": "React UI Component for slideshow like SlideShare or SpeakerDeck.",

src/SlideShow.jsx

+13-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,19 @@ export default class SlideShow extends React.Component {
366366
/>
367367
);
368368
});
369-
const fullscreenBottom = document.mozFullScreen ? 180 : 120;
369+
let fullscreenBottom = 120;
370+
const wrapper = document.querySelector('.slideshow-wrapper');
371+
const content = document.querySelector('.content');
372+
const progressBar = document.querySelector('.progressBar');
373+
const bar = document.querySelector('.bar');
374+
if (wrapper && content && progressBar && bar) {
375+
fullscreenBottom =
376+
window.screen.availHeight -
377+
content.offsetHeight +
378+
progressBar.offsetHeight +
379+
bar.offsetHeight +
380+
10;
381+
}
370382
const bottom = this.state.isFullScreen
371383
? fullscreenBottom
372384
: styles.PREVIEW.bottom;

0 commit comments

Comments
 (0)