diff --git a/index.html b/index.html index 06b3841..151a6b7 100644 --- a/index.html +++ b/index.html @@ -14,14 +14,15 @@ - +
Site views counter:
diff --git a/js/darkmoderewrite.js b/js/darkmoderewrite.js new file mode 100644 index 0000000..b34c854 --- /dev/null +++ b/js/darkmoderewrite.js @@ -0,0 +1,26 @@ +$(document).ready(function() { + function updateDarkMode() { + var isChecked = $("#darkModeCheckbox").is(":checked"); + if (isChecked) { + const body = document.querySelector('body'); + body.style.backgroundColor = '#404040'; + + const text = document.querySelector('.footer'); + text.style.backgroundColor = 'grey'; + + } else { + const body = document.querySelector('body'); + body.style.backgroundColor = '#f1f1f1'; + + const text = document.querySelector('.footer'); + text.style.backgroundColor = '#ddd'; + + } + } + + $("#darkModeCheckbox").on("change", function() { + updateDarkMode(); + }); + + updateDarkMode(); +});