started implementing cookies popup; made a "common-style" css file to keep everything tidy and not have duplicate code
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
$(document).ready(function(){
|
||||
$(window).scroll(function(){
|
||||
if($(this).scrollTop() > $(window).height()*0.3){
|
||||
$(".arrow-down").css({"opacity" : "0"})
|
||||
$(".arrow-down").css({"opacity" : "0"});
|
||||
} else {
|
||||
$(".arrow-down").css({"opacity" : "0.4"})
|
||||
$(".arrow-down").css({"opacity" : "0.4"});
|
||||
}
|
||||
})
|
||||
})
|
||||
28
scripts/policy-popup.js
Normal file
28
scripts/policy-popup.js
Normal file
@@ -0,0 +1,28 @@
|
||||
function openPolicyPopup() {
|
||||
if(getCookie("consent") === "true") return;
|
||||
|
||||
$("#policy-popup").fadeIn(1000); // Enable the div
|
||||
}
|
||||
|
||||
function agreePolicyPopup() {
|
||||
const _paq = window._paq || [];
|
||||
_paq.push(['rememberConsentGiven']); // todo: check if this works
|
||||
$("#policy-popup").fadeOut(1000); // Disable the div
|
||||
document.cookie = "consent=true"; // todo: check if already present? also, firefox was throwing a warning...
|
||||
}
|
||||
|
||||
function getCookie(cname) {
|
||||
var name = cname + "=";
|
||||
var decodedCookie = decodeURIComponent(document.cookie);
|
||||
var ca = decodedCookie.split(';');
|
||||
for(var i = 0; i <ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) === ' ') {
|
||||
c = c.substring(1);
|
||||
}
|
||||
if (c.indexOf(name) === 0) {
|
||||
return c.substring(name.length, c.length);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
Reference in New Issue
Block a user