When the toggle between dark mode and light mode is entered, the detection of dark mode input to the body is ignored.
Is it difficult to detect the user system and automatically change the toggle if the user is a dark mode setting system?
``
jQuery(window).on( 'load', function(){
var swiper = new Swiper('.swiper-scroller', {
slidesPerView: 'auto',
spaceBetween: 50,
freeMode: true,
grabCursor: true,
navigation: {
nextEl: '.slider-arrow-right-1',
prevEl: '.slider-arrow-left-1',
},
scrollbar: {
el: '.swiper-scrollbar',
},
mousewheel: true,
breakpoints: {
768: {
spaceBetween: 20,
},
576: {
spaceBetween: 15,
}
}
});
});
jQuery(document).ready( function($){
function modeSwitcher( elementCheck, elementParent ) {
if( elementCheck.filter(':checked').length > 0 ) {
elementParent.addClass('dark');
$('.mode-switcher').toggleClass('pts-switch-active');
} else {
elementParent.removeClass('dark');
$('.mode-switcher').toggleClass('pts-switch-active', false);
}
}
$('.pts-switcher').each( function(){
var element = $(this),
elementCheck = element.find(':checkbox'),
elementParent = $('body');
modeSwitcher( elementCheck, elementParent );
elementCheck.on( 'change', function(){
modeSwitcher( elementCheck, elementParent );
});
});
});
