Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1.  
  2. $(document).ready(function() {
  3.  
  4. var ck = getCookie("showBar");
  5. console.log("cookie " + ck);
  6.  
  7. if (ck === null){
  8.  
  9. $('.cookie-notification').show();
  10.  
  11. console.log('CB anzeigen');
  12.  
  13. $(".js-cookie-notification-hide").click(function() {
  14. $(".cookie-notification").fadeOut(1000);
  15. $.cookie('showBar', false);
  16. });
  17. }
  18. else {
  19. $(".cookie-notification").hide();
  20. console.log('CB nicht mehr anzeigen');
  21.  
  22. }
  23.  
  24. console.log("cookie after click " + ck);
  25.  
  26. function setCookie(cname, cvalue) {
  27. document.cookie = cname + "=" + cvalue;
  28. console.log(document.cookie);
  29. }
  30.  
  31. function getCookie(name) {
  32. function escape(s) { return s.replace(/([.*+?\^${}()|\[\]\/\\])/g, '\\$1'); };
  33. var match = document.cookie.match(RegExp('(?:^|;\\s*)' + escape(name) + '=([^;]*)'));
  34. return match ? match[1] : null;
  35. }
  36.  
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement