Udoro

Dismissable ads section with cookie

May 23rd, 2021 (edited)
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 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. /* ----------------- SET COOKIES TO EXPIRE AT END OF BROWSER SESSION ----------------- */
  24.  
  25. document.cookie = "section-advert=section-advert-1";
  26.  
  27.  
  28.  
  29. /* --------------- SET COOKIES TO EXPIRE AFTER 1 DAY (replace 1 with any number of days) ----------------------
  30.  
  31. document.cookie = "name-of-cokie=value-of-cookie; max-age=" + 1*24*60*60;
  32. (use any name and any value)
  33. */
  34.  
  35. }
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
Add Comment
Please, Sign In to add comment