I'm using slick slider, but for whatever the reason when I move mouse over a next
or previous
button it doesn't change the opacity (mouse-out: 0.5, mouse-in: 1) and it just stays 1
, is there a way I could apply jQuery to change the CSS for this task? The elements I want to add jQuery to are shown below:
.slick-prev:hover:before,
.slick-prev:focus:before,
.slick-next:hover:before,
.slick-next:focus:before
{
opacity: 1;
}
.slick-prev:before,
.slick-prev:before,
.slick-next:before,
.slick-next:before
{
opacity: 0.5;
}
In short: No, you can't.
Detailed answer:
The elements you are using are called pseudo-elements (
:before
,:after
, etc). They are not present in theDOM
, so you can't select either of them and change their style.A possible workaround:
Override that styles by declaring another rules of style for the same elements (for example, by injecting a
STYLE
tag which contains the styles which will override the existing one).