List view
Getting Started
Getting Started
Customizing Notion Blocks
Customizing Notion Blocks
References
References
Code Snippets
Scrollbar and Cookie Consent
Enhance the Scrollbar Appearance and Style
You also has the access to enhance the appearance and style of the scroll bar of your site. Use the below snippet to enhance your scroll bar appearance and style:
html ::-webkit-scrollbar-track { background-color: #fa8bff !important; background-image: linear-gradient(180deg, #f79533, #f37055 16.67%, #ef4e7b 33.34%, #a166ab 50.01%, #5073b8 66.68%, #1098ad 83.35%, #07b39b 100%) !important; } ::-webkit-scrollbar { width: 0.7rem; } ::-webkit-scrollbar-thumb { background: lightgray; border-radius: 20px; }
GDPR Cookie consent banner
Paste the below code inside Code > Body. This will display a GDPR cookie banner at the bottom of your website.
<div id="cookie-consent" class="cookie-container" style="border-radius: 8px; width: 17%; position: fixed; left: 20px; bottom: 20px; box-shadow: rgba(0, 0, 0, 0.26) 2px 2px 5px; padding: 10px; background: white"> <p style="font-size: 12px;">By using our site you accept cookies and similar technologies for performance, experience and other purposes. See our updated Privacy Policy.</p> <button type="button" class="accept-btn" style="background: black; outline: unset; border: unset; color: white; width: 96%; margin: 10px auto 0px; cursor: pointer; border-radius: 8px; padding: 7px 14px;">Accept</button> </div> <script> const button = document.querySelectorAll(".accept-btn") const cookieEle = document.querySelectorAll(".cookie-container") const setCookie = (name, value, days) => { const date = new Date(); date.setTime(date.getTime() + (days*24*60*60*1000)); let expires = "expires="+ date.toUTCString(); document.cookie = name + "=" + value + ";" + expires + ";path=/"; } const deleteCookie = (name) => { const date = new Date(); date.setTime(date.getTime() + (24*60*60*1000)); let expires = "expires="+ date.toUTCString(); document.cookie = name + "=;" + expires + ";path=/"; } const getCookie = (cname) => { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for(let i = 0; i <ca.length; i++) { let c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } const acceptCookieConsent = () => { deleteCookie('user_consent_cookie'); setCookie('user_consent_cookie', 1, 60); document.getElementById("cookie-consent").classList.remove('d-block') document.getElementById("cookie-consent").classList.add('d-none') const hideCookie = cookieEle[0].className if(hideCookie.includes("d-none")){ cookieEle[0].style.display="none" }else{ console.log("className not set") } } button[0].addEventListener("click", () => { acceptCookieConsent() }) let cookie_consent = getCookie("user_consent_cookie"); if(cookie_consent != ""){ document.getElementById("cookie-consent").classList.add('d-none'); document.getElementById("cookie-consent").classList.remove('d-block') }else{ document.getElementById("cookie-consent").classList.add('d-block') document.getElementById("cookie-consent").classList.remove('d-none') } const hideCookie = cookieEle[0].className if(hideCookie.includes("d-none")){ cookieEle[0].style.display="none" } </script>