cookie_banner_canvas.php


Quell Code


<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>PureCookie Example</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style> 
body {
  margin: 0;
  font:normal 75% Arial, Helvetica, sans-serif;
} 
.cookieConsentContainer {
	z-index: 999;
	width: 350px;
	min-height: 20px;
	box-sizing: border-box;
	padding: 30px 30px 30px 30px;
	background: #232323;
	overflow: hidden;
	position: fixed;
  bottom: 30px;
	right: 30px;
	display: none;
}
.cookieConsentContainer .cookieTitle a {
	font-family: OpenSans, arial, "sans-serif";
	color: #FFFFFF;
	font-size: 22px;
	line-height: 20px;
	display: block;
}
.cookieConsentContainer .cookieDesc p {
	margin: 0;
	padding: 0;
	font-family: OpenSans, arial, "sans-serif";
	color: #FFFFFF;
	font-size: 13px;
	line-height: 20px;
	display: block;
	margin-top: 10px;
}
.cookieConsentContainer .cookieDesc a {
	font-family: OpenSans, arial, "sans-serif";
	color: #FFFFFF;
	text-decoration: underline;
}
.cookieConsentContainer .cookieButton a {
	display: inline-block;
	font-family: OpenSans, arial, "sans-serif";
	color: #FFFFFF;
	font-size: 14px;
	font-weight: bold;
	margin-top: 14px;
	background: #000000;
	box-sizing: border-box; 
	padding: 15px 24px;
	text-align: center;
	transition: background 0.3s;
}
.cookieConsentContainer .cookieButton a:hover { 
	cursor: pointer;
	background: #3E9B67;
}

@media (max-width: 980px) {
	.cookieConsentContainer {
		bottom: 0px !important;
		left: 0px !important;
		width: 100%  !important;
	}
}

canvas {
  display: block;
  vertical-align: bottom;
}
#particles-js {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #b61924;
  background-image: url("");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: 50% 50%;
}
</style>
<script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>  
</head>
<body>
<div id="particles-js"></div>
<script>
/* ---- particles.js config ---- */
particlesJS("particles-js", {
  "particles": {
    "number": {
      "value": 380,
      "density": {
        "enable": true,
        "value_area": 800
      }
    },
    "color": {
      "value": "#ffffff"
    },
    "shape": {
      "type": "circle",
      "stroke": {
        "width": 0,
        "color": "#000000"
      },
      "polygon": {
        "nb_sides": 5
      },
      "image": {
        "src": "img/github.svg",
        "width": 100,
        "height": 100
      }
    },
    "opacity": {
      "value": 0.5,
      "random": false,
      "anim": {
        "enable": false,
        "speed": 1,
        "opacity_min": 0.1,
        "sync": false
      }
    },
    "size": {
      "value": 3,
      "random": true,
      "anim": {
        "enable": false,
        "speed": 40,
        "size_min": 0.1,
        "sync": false
      }
    },
    "line_linked": {
      "enable": true,
      "distance": 150,
      "color": "#ffffff",
      "opacity": 0.4,
      "width": 1
    },
    "move": {
      "enable": true,
      "speed": 6,
      "direction": "none",
      "random": false,
      "straight": false,
      "out_mode": "out",
      "bounce": false,
      "attract": {
        "enable": false,
        "rotateX": 600,
        "rotateY": 1200
      }
    }
  },
  "interactivity": {
    "detect_on": "canvas",
    "events": {
      "onhover": {
        "enable": true,
        "mode": "grab"
      },
      "onclick": {
        "enable": true,
        "mode": "push"
      },
      "resize": true
    },
    "modes": {
      "grab": {
        "distance": 140,
        "line_linked": {
          "opacity": 1
        }
      },
      "bubble": {
        "distance": 400,
        "size": 40,
        "duration": 2,
        "opacity": 8,
        "speed": 3
      },
      "repulse": {
        "distance": 200,
        "duration": 0.4
      },
      "push": {
        "particles_nb": 4
      },
      "remove": {
        "particles_nb": 2
      }
    }
  },
  "retina_detect": true
});
</script>

  <script>
// diesen Inhalt bei dir in der Js benutzen
var purecookieTitle = "Cookies."; // Title
var purecookieDesc = "By using this website, you automatically accept that we use cookies."; // Description
var purecookieLink = '<a href="cookie-policy.html" target="_blank">What for?</a>'; // Cookiepolicy link
var purecookieButton = "Understood"; // Button text

function pureFadeIn(elem, display){
  var el = document.getElementById(elem);
  el.style.opacity = 0;
  el.style.display = display || "block";
  (function fade() {
    var val = parseFloat(el.style.opacity);
    if (!((val += .02) > 1)) {
      el.style.opacity = val;
      requestAnimationFrame(fade);
    }
  })();
};
function pureFadeOut(elem){
  var el = document.getElementById(elem);
  el.style.opacity = 1;
  (function fade() {
    if ((el.style.opacity -= .02) < 0) {
      el.style.display = "none";
    } else {
      requestAnimationFrame(fade);
    }
  })();
};
function setCookie(name,value,days) {
    var expires = "";
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days*24*60*60*1000));
        expires = "; expires=" + date.toUTCString();
    }
    document.cookie = name + "=" + (value || "")  + expires + "; path=/";
}
function getCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}
function eraseCookie(name) {   
    document.cookie = name+'=; Max-Age=-99999999;';  
}
function cookieConsent() {
  if (!getCookie('purecookieDismiss')) {
    var body_conti=document.getElementsByTagName('body')[0];
    var cookie_conti=document.createElement('div');
    cookie_conti.setAttribute('class','cookieConsentContainer');
    cookie_conti.setAttribute('id','cookieConsentContainer');
    cookie_conti.innerHTML = `
       <div class="cookieTitle">
              <a>${purecookieTitle}</a>
       </div>
       <div class="cookieDesc">
              <p>${purecookieDesc}${purecookieLink}</p>
       </div>
       <div class="cookieButton">
            <a onClick="purecookieDismiss();">${purecookieButton}</a>
       </div>`;
    body_conti.append(cookie_conti);
	  pureFadeIn("cookieConsentContainer");
  }
}
function purecookieDismiss() {
  setCookie('purecookieDismiss','1',7);
  pureFadeOut("cookieConsentContainer");
}
window.onload = function() { cookieConsent(); };
  </script>
</body>
</html>
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>PureCookie Example</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <style>
  8. body {
  9. margin: 0;
  10. font:normal 75% Arial, Helvetica, sans-serif;
  11. }
  12. .cookieConsentContainer {
  13. z-index: 999;
  14. width: 350px;
  15. min-height: 20px;
  16. box-sizing: border-box;
  17. padding: 30px 30px 30px 30px;
  18. background: #232323;
  19. overflow: hidden;
  20. position: fixed;
  21. bottom: 30px;
  22. right: 30px;
  23. display: none;
  24. }
  25. .cookieConsentContainer .cookieTitle a {
  26. font-family: OpenSans, arial, "sans-serif";
  27. color: #FFFFFF;
  28. font-size: 22px;
  29. line-height: 20px;
  30. display: block;
  31. }
  32. .cookieConsentContainer .cookieDesc p {
  33. margin: 0;
  34. padding: 0;
  35. font-family: OpenSans, arial, "sans-serif";
  36. color: #FFFFFF;
  37. font-size: 13px;
  38. line-height: 20px;
  39. display: block;
  40. margin-top: 10px;
  41. }
  42. .cookieConsentContainer .cookieDesc a {
  43. font-family: OpenSans, arial, "sans-serif";
  44. color: #FFFFFF;
  45. text-decoration: underline;
  46. }
  47. .cookieConsentContainer .cookieButton a {
  48. display: inline-block;
  49. font-family: OpenSans, arial, "sans-serif";
  50. color: #FFFFFF;
  51. font-size: 14px;
  52. font-weight: bold;
  53. margin-top: 14px;
  54. background: #000000;
  55. box-sizing: border-box;
  56. padding: 15px 24px;
  57. text-align: center;
  58. transition: background 0.3s;
  59. }
  60. .cookieConsentContainer .cookieButton a:hover {
  61. cursor: pointer;
  62. background: #3E9B67;
  63. }
  64. @media (max-width: 980px) {
  65. .cookieConsentContainer {
  66. bottom: 0px !important;
  67. left: 0px !important;
  68. width: 100% !important;
  69. }
  70. }
  71. canvas {
  72. display: block;
  73. vertical-align: bottom;
  74. }
  75. #particles-js {
  76. position: absolute;
  77. width: 100%;
  78. height: 100%;
  79. background-color: #b61924;
  80. background-image: url("");
  81. background-repeat: no-repeat;
  82. background-size: cover;
  83. background-position: 50% 50%;
  84. }
  85. </style>
  86. <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
  87. </head>
  88. <body>
  89. <div id="particles-js"></div>
  90. <script>
  91. /* ---- particles.js config ---- */
  92. particlesJS("particles-js", {
  93. "particles": {
  94. "number": {
  95. "value": 380,
  96. "density": {
  97. "enable": true,
  98. "value_area": 800
  99. }
  100. },
  101. "color": {
  102. "value": "#ffffff"
  103. },
  104. "shape": {
  105. "type": "circle",
  106. "stroke": {
  107. "width": 0,
  108. "color": "#000000"
  109. },
  110. "polygon": {
  111. "nb_sides": 5
  112. },
  113. "image": {
  114. "src": "img/github.svg",
  115. "width": 100,
  116. "height": 100
  117. }
  118. },
  119. "opacity": {
  120. "value": 0.5,
  121. "random": false,
  122. "anim": {
  123. "enable": false,
  124. "speed": 1,
  125. "opacity_min": 0.1,
  126. "sync": false
  127. }
  128. },
  129. "size": {
  130. "value": 3,
  131. "random": true,
  132. "anim": {
  133. "enable": false,
  134. "speed": 40,
  135. "size_min": 0.1,
  136. "sync": false
  137. }
  138. },
  139. "line_linked": {
  140. "enable": true,
  141. "distance": 150,
  142. "color": "#ffffff",
  143. "opacity": 0.4,
  144. "width": 1
  145. },
  146. "move": {
  147. "enable": true,
  148. "speed": 6,
  149. "direction": "none",
  150. "random": false,
  151. "straight": false,
  152. "out_mode": "out",
  153. "bounce": false,
  154. "attract": {
  155. "enable": false,
  156. "rotateX": 600,
  157. "rotateY": 1200
  158. }
  159. }
  160. },
  161. "interactivity": {
  162. "detect_on": "canvas",
  163. "events": {
  164. "onhover": {
  165. "enable": true,
  166. "mode": "grab"
  167. },
  168. "onclick": {
  169. "enable": true,
  170. "mode": "push"
  171. },
  172. "resize": true
  173. },
  174. "modes": {
  175. "grab": {
  176. "distance": 140,
  177. "line_linked": {
  178. "opacity": 1
  179. }
  180. },
  181. "bubble": {
  182. "distance": 400,
  183. "size": 40,
  184. "duration": 2,
  185. "opacity": 8,
  186. "speed": 3
  187. },
  188. "repulse": {
  189. "distance": 200,
  190. "duration": 0.4
  191. },
  192. "push": {
  193. "particles_nb": 4
  194. },
  195. "remove": {
  196. "particles_nb": 2
  197. }
  198. }
  199. },
  200. "retina_detect": true
  201. });
  202. </script>
  203. <script>
  204. // diesen Inhalt bei dir in der Js benutzen
  205. var purecookieTitle = "Cookies."; // Title
  206. var purecookieDesc = "By using this website, you automatically accept that we use cookies."; // Description
  207. var purecookieLink = '<a href="cookie-policy.html" target="_blank">What for?</a>'; // Cookiepolicy link
  208. var purecookieButton = "Understood"; // Button text
  209. function pureFadeIn(elem, display){
  210. var el = document.getElementById(elem);
  211. el.style.opacity = 0;
  212. el.style.display = display || "block";
  213. (function fade() {
  214. var val = parseFloat(el.style.opacity);
  215. if (!((val += .02) > 1)) {
  216. el.style.opacity = val;
  217. requestAnimationFrame(fade);
  218. }
  219. })();
  220. };
  221. function pureFadeOut(elem){
  222. var el = document.getElementById(elem);
  223. el.style.opacity = 1;
  224. (function fade() {
  225. if ((el.style.opacity -= .02) < 0) {
  226. el.style.display = "none";
  227. } else {
  228. requestAnimationFrame(fade);
  229. }
  230. })();
  231. };
  232. function setCookie(name,value,days) {
  233. var expires = "";
  234. if (days) {
  235. var date = new Date();
  236. date.setTime(date.getTime() + (days*24*60*60*1000));
  237. expires = "; expires=" + date.toUTCString();
  238. }
  239. document.cookie = name + "=" + (value || "") + expires + "; path=/";
  240. }
  241. function getCookie(name) {
  242. var nameEQ = name + "=";
  243. var ca = document.cookie.split(';');
  244. for(var i=0;i < ca.length;i++) {
  245. var c = ca[i];
  246. while (c.charAt(0)==' ') c = c.substring(1,c.length);
  247. if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  248. }
  249. return null;
  250. }
  251. function eraseCookie(name) {
  252. document.cookie = name+'=; Max-Age=-99999999;';
  253. }
  254. function cookieConsent() {
  255. if (!getCookie('purecookieDismiss')) {
  256. var body_conti=document.getElementsByTagName('body')[0];
  257. var cookie_conti=document.createElement('div');
  258. cookie_conti.setAttribute('class','cookieConsentContainer');
  259. cookie_conti.setAttribute('id','cookieConsentContainer');
  260. cookie_conti.innerHTML = `
  261. <div class="cookieTitle">
  262. <a>${purecookieTitle}</a>
  263. </div>
  264. <div class="cookieDesc">
  265. <p>${purecookieDesc}${purecookieLink}</p>
  266. </div>
  267. <div class="cookieButton">
  268. <a onClick="purecookieDismiss();">${purecookieButton}</a>
  269. </div>`;
  270. body_conti.append(cookie_conti);
  271. pureFadeIn("cookieConsentContainer");
  272. }
  273. }
  274. function purecookieDismiss() {
  275. setCookie('purecookieDismiss','1',7);
  276. pureFadeOut("cookieConsentContainer");
  277. }
  278. window.onload = function() { cookieConsent(); };
  279. </script>
  280. </body>
  281. </html>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>PureCookie Example</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style> 
body {
  margin: 0;
  font:normal 75% Arial, Helvetica, sans-serif;
} 
.cookieConsentContainer {
	z-index: 999;
	width: 350px;
	min-height: 20px;
	box-sizing: border-box;
	padding: 30px 30px 30px 30px;
	background: #232323;
	overflow: hidden;
	position: fixed;
  bottom: 30px;
	right: 30px;
	display: none;
}
.cookieConsentContainer .cookieTitle a {
	font-family: OpenSans, arial, "sans-serif";
	color: #FFFFFF;
	font-size: 22px;
	line-height: 20px;
	display: block;
}
.cookieConsentContainer .cookieDesc p {
	margin: 0;
	padding: 0;
	font-family: OpenSans, arial, "sans-serif";
	color: #FFFFFF;
	font-size: 13px;
	line-height: 20px;
	display: block;
	margin-top: 10px;
}
.cookieConsentContainer .cookieDesc a {
	font-family: OpenSans, arial, "sans-serif";
	color: #FFFFFF;
	text-decoration: underline;
}
.cookieConsentContainer .cookieButton a {
	display: inline-block;
	font-family: OpenSans, arial, "sans-serif";
	color: #FFFFFF;
	font-size: 14px;
	font-weight: bold;
	margin-top: 14px;
	background: #000000;
	box-sizing: border-box; 
	padding: 15px 24px;
	text-align: center;
	transition: background 0.3s;
}
.cookieConsentContainer .cookieButton a:hover { 
	cursor: pointer;
	background: #3E9B67;
}

@media (max-width: 980px) {
	.cookieConsentContainer {
		bottom: 0px !important;
		left: 0px !important;
		width: 100%  !important;
	}
}

canvas {
  display: block;
  vertical-align: bottom;
}
#particles-js {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #b61924;
  background-image: url("");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: 50% 50%;
}
</style>
<script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>  
</head>
<body>
<div id="particles-js"></div>
<script>
/* ---- particles.js config ---- */
particlesJS("particles-js", {
  "particles": {
    "number": {
      "value": 380,
      "density": {
        "enable": true,
        "value_area": 800
      }
    },
    "color": {
      "value": "#ffffff"
    },
    "shape": {
      "type": "circle",
      "stroke": {
        "width": 0,
        "color": "#000000"
      },
      "polygon": {
        "nb_sides": 5
      },
      "image": {
        "src": "img/github.svg",
        "width": 100,
        "height": 100
      }
    },
    "opacity": {
      "value": 0.5,
      "random": false,
      "anim": {
        "enable": false,
        "speed": 1,
        "opacity_min": 0.1,
        "sync": false
      }
    },
    "size": {
      "value": 3,
      "random": true,
      "anim": {
        "enable": false,
        "speed": 40,
        "size_min": 0.1,
        "sync": false
      }
    },
    "line_linked": {
      "enable": true,
      "distance": 150,
      "color": "#ffffff",
      "opacity": 0.4,
      "width": 1
    },
    "move": {
      "enable": true,
      "speed": 6,
      "direction": "none",
      "random": false,
      "straight": false,
      "out_mode": "out",
      "bounce": false,
      "attract": {
        "enable": false,
        "rotateX": 600,
        "rotateY": 1200
      }
    }
  },
  "interactivity": {
    "detect_on": "canvas",
    "events": {
      "onhover": {
        "enable": true,
        "mode": "grab"
      },
      "onclick": {
        "enable": true,
        "mode": "push"
      },
      "resize": true
    },
    "modes": {
      "grab": {
        "distance": 140,
        "line_linked": {
          "opacity": 1
        }
      },
      "bubble": {
        "distance": 400,
        "size": 40,
        "duration": 2,
        "opacity": 8,
        "speed": 3
      },
      "repulse": {
        "distance": 200,
        "duration": 0.4
      },
      "push": {
        "particles_nb": 4
      },
      "remove": {
        "particles_nb": 2
      }
    }
  },
  "retina_detect": true
});
</script>

  <script>
// diesen Inhalt bei dir in der Js benutzen
var purecookieTitle = "Cookies."; // Title
var purecookieDesc = "By using this website, you automatically accept that we use cookies."; // Description
var purecookieLink = '<a href="cookie-policy.html" target="_blank">What for?</a>'; // Cookiepolicy link
var purecookieButton = "Understood"; // Button text

function pureFadeIn(elem, display){
  var el = document.getElementById(elem);
  el.style.opacity = 0;
  el.style.display = display || "block";
  (function fade() {
    var val = parseFloat(el.style.opacity);
    if (!((val += .02) > 1)) {
      el.style.opacity = val;
      requestAnimationFrame(fade);
    }
  })();
};
function pureFadeOut(elem){
  var el = document.getElementById(elem);
  el.style.opacity = 1;
  (function fade() {
    if ((el.style.opacity -= .02) < 0) {
      el.style.display = "none";
    } else {
      requestAnimationFrame(fade);
    }
  })();
};
function setCookie(name,value,days) {
    var expires = "";
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days*24*60*60*1000));
        expires = "; expires=" + date.toUTCString();
    }
    document.cookie = name + "=" + (value || "")  + expires + "; path=/";
}
function getCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}
function eraseCookie(name) {   
    document.cookie = name+'=; Max-Age=-99999999;';  
}
function cookieConsent() {
  if (!getCookie('purecookieDismiss')) {
    var body_conti=document.getElementsByTagName('body')[0];
    var cookie_conti=document.createElement('div');
    cookie_conti.setAttribute('class','cookieConsentContainer');
    cookie_conti.setAttribute('id','cookieConsentContainer');
    cookie_conti.innerHTML = `
       <div class="cookieTitle">
              <a>${purecookieTitle}</a>
       </div>
       <div class="cookieDesc">
              <p>${purecookieDesc}${purecookieLink}</p>
       </div>
       <div class="cookieButton">
            <a onClick="purecookieDismiss();">${purecookieButton}</a>
       </div>`;
    body_conti.append(cookie_conti);
	  pureFadeIn("cookieConsentContainer");
  }
}
function purecookieDismiss() {
  setCookie('purecookieDismiss','1',7);
  pureFadeOut("cookieConsentContainer");
}
window.onload = function() { cookieConsent(); };
  </script>
</body>
</html>

Error: No site found with the domain 'test.basti1012.bplaced.net' (Learn more)
vConsole
15:34:12
Uncaught TypeError: Cannot read properties of null (reading 'style')
/my_codepen/index.php?name=cookie_banner_canvas.php&ordner=my_codepen:2755:53
15:34:13
500
15:34:12
WeChatLib: 0 (xxxx.xx.xx)
15:34:13
System: Unknown
15:34:13
Protocol: HTTPS
15:34:13
UA: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
15:34:13
navigationStart: 1743953651480
15:34:13
navigation: 1ms
15:34:13
dns: 0ms
15:34:13
tcp: 0ms
15:34:13
request: 217ms
15:34:13
response: 109ms
15:34:13
domComplete (domLoaded): 1507ms (1282ms)
15:34:13
loadEvent: 16ms
15:34:13
total (DOM): 2240ms (2224ms)