Home › Forums › JavaScript › Dark/Light color switch › Reply To: Dark/Light color switch
September 27, 2017 at 12:08 pm
#260664
Shikkediel
Participant
You won’t be able to switch colour on the pseudo elements (if that was the idea)…
Here’s some generic code, I’d probably choose the filter
function for it:
$('button').click(function() {
if ($(this).index() == 1) {
$('.line').filter(function() {
if ($(this).css('background-color') == 'rgb(241, 74, 255)') return this;
})
.css('background-color', 'black');
}
});
Edit – actually, you can with a bit of CSS trickery: