Fixed problem with dropdown menus in responsive tables (grids)

This commit is contained in:
Lucas Bartholemy 2017-10-28 22:26:54 +02:00
parent 246b6c38ab
commit 4e432faf6d

View File

@ -101,6 +101,26 @@ humhub.module('ui.additions', function (module, require, $) {
}); });
}); });
// Workaround: Bootstrap bug with dropdowns in responsive tables
// See: https://github.com/twbs/bootstrap/issues/11037
$(document).on('shown.bs.dropdown', '.table-responsive', function (e) {
var t = $(this),
m = $(e.target).find('.dropdown-menu'),
tb = t.offset().top + t.height(),
mb = m.offset().top + m.outerHeight(true),
d = 20; // Space for shadow + scrollbar.
if (t[0].scrollWidth > t.innerWidth()) {
if (mb + d > tb) {
t.css('padding-bottom', ((mb + d) - tb));
}
} else {
t.css('overflow', 'visible');
}
}).on('hidden.bs.dropdown', '.table-responsive', function () {
$(this).css({'padding-bottom': '', 'overflow': ''});
});
// workaround for jp-player since it sets display to inline which results in a broken view... // workaround for jp-player since it sets display to inline which results in a broken view...
$(document).on('click.humhub-jp-play', '.jp-play', function () { $(document).on('click.humhub-jp-play', '.jp-play', function () {
$(this).closest('.jp-controls').find('.jp-pause').css('display', 'block'); $(this).closest('.jp-controls').find('.jp-pause').css('display', 'block');