Fixed dialog pos and expand.
parent
037e26f42b
commit
4e594dd573
20
js/h5p.js
20
js/h5p.js
|
@ -159,8 +159,7 @@ H5P.init = function () {
|
||||||
// When resize has been prepared tell parent window to resize
|
// When resize has been prepared tell parent window to resize
|
||||||
H5P.communicator.on('resizePrepared', function (data) {
|
H5P.communicator.on('resizePrepared', function (data) {
|
||||||
H5P.communicator.send('resize', {
|
H5P.communicator.send('resize', {
|
||||||
height: document.body.scrollHeight,
|
height: document.body.scrollHeight
|
||||||
parentHeight: data.parentHeight
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -722,13 +721,18 @@ H5P.openEmbedDialog = function ($element, embedCode, resizeCode, size) {
|
||||||
// Selecting embed code when dialog is opened
|
// Selecting embed code when dialog is opened
|
||||||
H5P.jQuery(dialog).on('dialog-opened', function (event, $dialog) {
|
H5P.jQuery(dialog).on('dialog-opened', function (event, $dialog) {
|
||||||
var $inner = $dialog.find('.h5p-inner');
|
var $inner = $dialog.find('.h5p-inner');
|
||||||
|
var $scroll = $inner.find('.h5p-scroll-content');
|
||||||
|
var diff = $scroll.outerHeight() - $scroll.innerHeight();
|
||||||
var positionInner = function () {
|
var positionInner = function () {
|
||||||
$inner.css('height', '');
|
var height = $inner.height();
|
||||||
var h = $inner.height();
|
if ($scroll[0].scrollHeight + diff > height) {
|
||||||
if (Math.floor($dialog.height()) === h) {
|
$inner.css('height', ''); // 100%
|
||||||
$inner.css('height', '100%');
|
|
||||||
}
|
}
|
||||||
$inner.css('marginTop', '-' + (h / 2) + 'px');
|
else {
|
||||||
|
$inner.css('height', 'auto');
|
||||||
|
height = $inner.height();
|
||||||
|
}
|
||||||
|
$inner.css('marginTop', '-' + (height / 2) + 'px');
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle changing of width/height
|
// Handle changing of width/height
|
||||||
|
@ -781,7 +785,7 @@ H5P.openEmbedDialog = function ($element, embedCode, resizeCode, size) {
|
||||||
};
|
};
|
||||||
$dialog.find('.h5p-expander').click(expand).keypress(function (event) {
|
$dialog.find('.h5p-expander').click(expand).keypress(function (event) {
|
||||||
if (event.keyCode === 32) {
|
if (event.keyCode === 32) {
|
||||||
expand();
|
expand.apply(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -252,7 +252,6 @@ div.h5p-fullscreen {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
height: auto;
|
|
||||||
margin: 0 0 0 -150px;
|
margin: 0 0 0 -150px;
|
||||||
}
|
}
|
||||||
.h5p-embed-dialog .h5p-embed-code-container,
|
.h5p-embed-dialog .h5p-embed-code-container,
|
||||||
|
|
Loading…
Reference in New Issue