0

I made a little Jquery script to modify the colors of the layout clicking a toggle button. If I change or reload the page I have to reclick the button.

Is it possible to keep the change and then return to the original colors only by clicking the button again(toggle)?

Here is the code

<button ID="btnToggleClass"><i class="fa fa-magic"></i></button>

$(document).ready(function() {

  $('#btnToggleClass').click(function() {

    $('body, #discover, header, footer .col-33, .wp-block-column, .card').toggleClass('backCol');
    $('.sym-home-p, .post p, .nav-wrap a, .page p, .sym-services h3, .wpforms-container .wpforms-field-label-inline').toggleClass('whiteText');
    $('.sym-h3, .nav-wrap span strong, .blog h2 a').toggleClass('black-sym-h3');
    $('.wp-block-button__link').toggleClass('redButton');
    $('.logo').toggleClass('logo-white');
    $('.sym-cover-title-2, .sym-cover-title').toggleClass('titBlack');
    $('h1, .comment-reply-title, .post h3, .wpforms-container .wpforms-field-label').toggleClass('titAzul');
    $('aside h3, .post p a').toggleClass('redColor');


  });

});
CarlVarsh
  • 53
  • 10
  • 1
    I made you a snippet. Please add relevant HTML. I would guess you are looking for [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) – mplungjan Jun 03 '20 at 09:02
  • Hi @mplungjan , I added the html is very simple, it's in header.php of a custom WP theme. Thanks for the support! – CarlVarsh Jun 03 '20 at 09:17
  • Please edit then scroll down, click "edit above snippet" then add RELEVANT HTML AND CSS in a [mcve] - but first read the dupes and see if they do not help you – mplungjan Jun 03 '20 at 09:26

0 Answers0