I am trying to make list elements opacity change from the element which is hovered my html markup is
<ul class="list-unstyled">
<li>
Lorem ipsum dolor sit amet
</li>
<li>
Consectetur adipiscing elit
</li>
<li>
Integer molestie lorem at massa
</li>
<li>
Facilisis in pretium nisl aliquet
</li>
<li>
Nulla volutpat aliquam velit
</li>
<li>
Faucibus porta lacus fringilla vel
</li>
<li>
Aenean sit amet erat nunc
</li>
<li>
Eget porttitor lorem
</li>
</ul>
where I am using this css
.list-unstyled li:first-of-type {
opacity:1;
}
.list-unstyled li:nth-of-type(2){
opacity:0.60;
}
.list-unstyled li:nth-of-type(3){
opacity:0.35;
}
.list-unstyled li {
opacity:0.35;
}
.list-unstyled li:hover {
opacity:1 !important;
}
.list-unstyled li:hover ~ li {
opacity:0.65 !important;
}
.list-unstyled li:hover ~ li ~li {
opacity:0.35 !important;
}
I want to make hovered elements immediate siblings to have 35% opacity layer and rest to them should have 65% opacity layer.
while at initial stage I want the first li element to have opacity layer as 1 and when it is unhovered it should change to respective styling as other elements are hovered How can I achieve this.