Jump to content

Eric Roth

Members
  • Content Count

    10
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Eric Roth

  • Rank
    Newbie

Contact Methods

  • Website URL
    https://ericroth.org

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello, Searched around but no luck...:-( In this countdown timer: https://www.w3schools.com/howto/howto_js_countdown.asp I try to get the seconds (not the "s") shown in red color. Could anyone point me to how to achieve that? Thanks, Eric
  2. That worked! Thank you Funce, you have been very helpful.
  3. ...spent a couple of hours without any luck. How to implement storage to currently held value?
  4. That helped - you are the best, thank you! A small "problem" though (of which I think, I understand the logic of the code and perhaps, this could not be solved with the way the toggle function is set up on the site). What happens now is that as soon as one toggles the mode from normal to dark, it stays in the dark mode. I mean, one can toggle back to the normal mode, yes - but when refreshing the page or moving on to another page, it loads in the dark mode again. Since this is local storage, the above happens even after closing and re-opening the browser (and thereby cleaning out all
  5. Hi, Many thanks for your reply and help. I worked with your code but it doesn't function. I also tried all kinds of varieties, I could think of - no luck. The latest, I have now in the script is this: // toggle mode if button is clicked $('.change-mode-button').click(function() { changeMode(); }); function changeMode() { var element = document.body; element.classList.toggle("dark-mode"); localStorage.setItem("changeMode", element.classList.contains("dark-mode")); if(localStorage.setItem("changeMode")) { element.classList.add("dark-mode"); }
  6. Hi Funce, Here is the JS code, I'm working with: <?php add_action( 'wp_footer', function() { ?> <script> jQuery(document).ready(function ($) { var change_mode_button_is_visible = false; var scroll_distance = 50; var $change_mode_button = $('<div class="change-mode-button" title="Toggle Mode"><img src="https://ericroth.org/wp-content/uploads/Home/Mode.png" alt="Toggle Mode" width="20" height="20" class="aligncenter wp-image-63135" /></div>'); // inject the button, so you don't have to create the button in any templates $change_mode_button.appendTo('bod
  7. Hello, Is there a way to combine dark mode (https://www.w3schools.com/howto/howto_js_toggle_dark_mode.asp) and local storage (https://www.w3schools.com/html/html5_webstorage.asp)? I managed to implement the dark mode function but fail to combine that with local storage, e.g. the user toggles to the dark mode and this stays even when refreshing the page or browsing to another within the same domain. You can see the dark mode function on my website here: https://ericroth.org/ Any help much appreciated, thanks!
  8. Hello, I found this helpful: "How To - Toggle Dark Mode" (https://www.w3schools.com/howto/howto_js_toggle_dark_mode.asp) and this one: "HTML5 - Web Storage" (https://www.w3schools.com/html/html5_webstorage.asp). Can anyone help to combine these two? I successfully implemented the "How To - Toggle Dark Mode" but fail to combine Local Storage together with it. Thanks! Cheers, Eric
×
×
  • Create New...