I tried that, but, for some reason, even that wasn’t working (mostly, I was doing it wrong).
However, I had a look at the link you sent for the extension project and found another one that worked: hypedocument.currentSceneElement
So, this code went to my <head>
:
<script>
function extendHype(hypeDocument, element, event)
{
hypeDocument.currentSceneElement = function()
{
return document.querySelector('#'+this.documentId()+' > .HYPE_scene[style*="block"]');
}
return true;
}
if("HYPE_eventListeners" in window === false)
{
window.HYPE_eventListeners = Array();
}
window.HYPE_eventListeners.push(
{
"type":"HypeDocumentLoad", "callback":extendHype
});
</script>
And that’s the code of my fuction to delete the element is the cookie is found:
var cookieName = getCookie("privacy");
if (cookieName === 'yes')
{
var elm = hypeDocument.currentSceneElement();
var child1 = elm.querySelector('.sticky');
child1.parentNode.removeChild(child1);
}