Udoro

Dismissable ads section with cookie (more options)

May 25th, 2021 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. /*
  2. In Oxygen Builder, set the close button attribute name to 'onclick' and value to 'myFunction()' without the quotes.
  3. */
  4.  
  5.  
  6. function myFunction() {
  7.  
  8. /* --------------- CLOSE SECTION WITHOUT FADE OUT -------------------*/
  9.  
  10. var x = document.getElementById("section-86-2").style;
  11. x.display = "none";
  12.  
  13.  
  14. /* ---------------- CLOSE SECTION WITH FADE OUT -----------------------------
  15.  
  16. var s = document.getElementById("section-86-2").style;
  17. s.opacity = 1;
  18. (function fade(){(s.opacity-=.1)<0?s.display="none":setTimeout(fade,40)})();
  19.  
  20. */
  21.  
  22.  
  23. /* --------------- REMOVE THE SECTION COMPLETELY FROM DOM without FADE OUT ------------------
  24.  
  25. var x = document.getElementById("section-102-2");
  26. x.parentNode.removeChild(x)
  27.  
  28. */
  29.  
  30.  
  31.  
  32. /* ------------- REMOVE THE SECTION COMPLETELY FROM DOM with FADE OUT --------------
  33.  
  34.  
  35. var s = document.getElementById("section-102-2").style;
  36. var x = document.getElementById("section-102-2");
  37. s.opacity = 1;
  38. (function fade(){(s.opacity-=.1)<0?x.parentNode.removeChild(x):setTimeout(fade,40)})();
  39. */
  40.  
  41.  
  42. /* ----------------- Set cookies expiration at the end of browser session ----------------- */
  43.  
  44. document.cookie = "section-advert=section-advert-1";
  45.  
  46.  
  47.  
  48. /* --------------- Set cookies expiration to 1 day (replace 1 with any number of days) ----------------------
  49.  
  50. document.cookie = "name=section-advert; max-age=" + 1*24*60*60;
  51. */
  52.  
  53. }
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
Add Comment
Please, Sign In to add comment