Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!---- day/night toggle----->
- <script>
- const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
- if (currentTheme === 'night') {
- $( 'body' ).addClass( 'night');
- }
- $(document).ready(function(){
- $('.daynight').click(function(){
- $(document).ready(function(){
- $('.daynight').click(function(){
- let theme = 'daynight';
- $('body').toggleClass('night');
- $('.daynight span').toggleClass('fa-sun');
- if ($('body').hasClass('night')) {
- theme = 'night';
- }
- localStorage.setItem('theme', theme);
- });
- });
- });
- });
- </script>
Add Comment
Please, Sign In to add comment