Better scroll management

This commit is contained in:
Amauri CHAMPEAUX 2018-09-11 10:40:49 +02:00 committed by GitHub
parent 6bd6555554
commit e156538555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -16,7 +16,7 @@ var scripts = document.getElementsByTagName('script'),
var tarteaucitron = {
"version": 20180910,
"version": 20180911002,
"cdn": cdn,
"user": {},
"lang": {},
@ -289,7 +289,7 @@ var tarteaucitron = {
html += ' </button>';
html += ' </div>';
html += ' </div>';
html += ' <div class="tarteaucitronBorder" id="tarteaucitronScrollbarParent">';
html += ' <div class="tarteaucitronBorder">';
html += ' <div class="clear"></div><ul>';
for (i = 0; i < cat.length; i += 1) {
html += ' <li id="tarteaucitronServicesTitle_' + cat[i] + '" class="tarteaucitronHidden">';
@ -932,20 +932,20 @@ var tarteaucitron = {
if (document.getElementById('tarteaucitron') !== null && document.getElementById('tarteaucitronClosePanel') !== null && document.getElementById('tarteaucitronMainLineOffset') !== null) {
// reset
tarteaucitron.userInterface.css('tarteaucitronScrollbarParent', 'height', 'auto');
tarteaucitron.userInterface.css('tarteaucitronServices', 'height', 'auto');
// calculate
mainHeight = document.getElementById('tarteaucitron').offsetHeight;
closeButtonHeight = document.getElementById('tarteaucitronClosePanel').offsetHeight;
headerHeight = document.getElementById('tarteaucitronMainLineOffset').offsetHeight;
// apply
servicesHeight = (mainHeight - closeButtonHeight - headerHeight + 1);
tarteaucitron.userInterface.css('tarteaucitronScrollbarParent', 'height', servicesHeight + 'px');
servicesHeight = (mainHeight - closeButtonHeight + 2);
tarteaucitron.userInterface.css('tarteaucitronServices', 'height', servicesHeight + 'px');
tarteaucitron.userInterface.css('tarteaucitronServices', 'overflow-x', 'auto');
}
// align the main allow/deny button depending on scrollbar width
if (document.getElementById('tarteaucitronScrollbarParent') !== null && document.getElementById('tarteaucitronScrollbarChild') !== null) {
if (document.getElementById('tarteaucitronServices') !== null && document.getElementById('tarteaucitronScrollbarChild') !== null) {
// media query
if (e[a + 'Width'] <= 479) {
@ -954,7 +954,7 @@ var tarteaucitron = {
scrollbarMarginRight = 12;
}
scrollbarWidthParent = document.getElementById('tarteaucitronScrollbarParent').offsetWidth;
scrollbarWidthParent = document.getElementById('tarteaucitronServices').offsetWidth;
scrollbarWidthChild = document.getElementById('tarteaucitronScrollbarChild').offsetWidth;
tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginRight', ((scrollbarWidthParent - scrollbarWidthChild) + scrollbarMarginRight) + 'px');
}