Merge pull request #393 from mobyou/patch-1

Add a bodyPosition param
This commit is contained in:
Amauri CHAMPEAUX 2020-03-04 16:45:44 +01:00 committed by GitHub
commit b7e4b632e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 2 deletions

View File

@ -225,6 +225,7 @@ var tarteaucitron = {
"cookieName": 'tarteaucitron', "cookieName": 'tarteaucitron',
"highPrivacy": true, "highPrivacy": true,
"orientation": "middle", "orientation": "middle",
"bodyPosition": "bottom",
"removeCredit": false, "removeCredit": false,
"showAlertSmall": true, "showAlertSmall": true,
"cookieslist": true, "cookieslist": true,
@ -468,7 +469,15 @@ var tarteaucitron = {
document.body.appendChild(wrapper);*/ document.body.appendChild(wrapper);*/
div.id = 'tarteaucitronRoot'; div.id = 'tarteaucitronRoot';
body.appendChild(div, body); if (tarteaucitron.parameters.bodyPosition === 'top') {
// Prepend tarteaucitron: #tarteaucitronRoot first-child of the body for better accessibility
var bodyFirstChild = body.firstChild;
body.insertBefore(div, bodyFirstChild);
}
else {
// Append tarteaucitron: #tarteaucitronRoot last-child of the body
body.appendChild(div, body);
}
div.innerHTML = html; div.innerHTML = html;
//ie compatibility //ie compatibility
@ -539,7 +548,15 @@ var tarteaucitron = {
html += '<div id="tarteaucitronPremium"></div>'; html += '<div id="tarteaucitronPremium"></div>';
div.id = 'tarteaucitronRoot'; div.id = 'tarteaucitronRoot';
body.appendChild(div, body); if (tarteaucitron.parameters.bodyPosition === 'top') {
// Prepend tarteaucitron: #tarteaucitronRoot first-child of the body for better accessibility
var bodyFirstChild = body.firstChild;
body.insertBefore(div, bodyFirstChild);
}
else {
// Append tarteaucitron: #tarteaucitronRoot last-child of the body
body.appendChild(div, body);
}
div.innerHTML = html; div.innerHTML = html;
} }
}, 1500); }, 1500);