Advertisement
fauzanjeg

Trigger Dark Mode Cookie

May 25th, 2021
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.32 KB | None | 0 0
  1. /** Trigger Dark Mode Cookie */
  2. (function ($) {
  3.     const jnews_dm = $('.jeg_dark_mode_toggle')
  4.     jnews_dm.change(function (e) {
  5.         e.preventDefault();
  6.        
  7.         if ($(this).is(':checked')) {
  8.             document.cookie = 'darkmode=true';
  9.         } else if (!$(this).is(':checked')) {
  10.             document.cookie = 'darkmode=false';
  11.         }
  12.     });
  13. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement