diff --git a/tarteaucitron.js b/tarteaucitron.js index 3c44f85..ff304fc 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -225,6 +225,7 @@ var tarteaucitron = { "cookieName": 'tarteaucitron', "highPrivacy": true, "orientation": "middle", + "bodyPosition": "bottom", "removeCredit": false, "showAlertSmall": true, "cookieslist": true, @@ -468,7 +469,15 @@ var tarteaucitron = { document.body.appendChild(wrapper);*/ 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; //ie compatibility @@ -539,7 +548,15 @@ var tarteaucitron = { html += '
'; 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; } }, 1500);