0
I want to change the display of the elements with the classes . slide-Prev and . slide-next. Since I’m using a slide plugin, it automatically creates the elements of browsing outside ul, so the only way the display change worked was with javascript. The problem is it didn’t work out the way it should.
When I pass the mouse over the div with the class . intro-news the elements appear, and when I leave they disappear, so far so good. The problem is when I pass the mouse over the elements . slide-Prev and . slide-next, they get shivering, fade depending on where the arrow is and don’t activate the Hover.
It may be that I let something simple pass, but I really did not find, if someone knows what is causing it I thank.
Video demonstrating the problem
Code:
$(".intro-noticias").hover(function() {
$('.slide-prev,.slide-next').css("display", "block");
}, function() {
$('.slide-prev,.slide-next').css("display", "none");
});
.intro-noticias {
width: 100%;
height: 85vh;
margin-top: 70px;
}
.slide-prev {
z-index: 20;
position: absolute;
top: 70px;
left: 0;
text-indent: -9999px;
height: 40px;
width: 40px;
border: solid 1px #fff;
background: rgba(0,0,0,0.5);
display: none;
}
.slide-prev:after {
content:"icon";
width: 20px;
height: 20px;
position: absolute;
bottom: 9.5px;
left: 2px;
display: block;
background: url("img/icones/previous.png") left center no-repeat;
}
.slide-prev:hover {
background: red;
transition: all 0.2s ease-in;
}
.slide-next {
z-index: 20;
position: absolute;
top: 70px;
left: 40px;
text-indent: -9999px;
height: 40px;
width: 40px;
border: solid 1px #fff;
background: rgba(0,0,0,0.5);
display: none;
}
.slide-next:after {
content:"icon";
width: 20px;
height: 20px;
position: absolute;
bottom: 9.5px;
right: 2px;
display: block;
background: url("img/icones/next.png") right center no-repeat;
}
.slide-next:hover {
background: red;
transition: all 0.2s ease-in;
}
<ul>
<li>
<div class="intro-noticias">
<div>
<h2></h2>
</div>
</div>
</li>
</ul>
<a href="#" class="slide-prev">Previous</a>
<a href="#" class="slide-next">Next</a>
Unfortunately it didn’t work
– Gabriel Souza
@Gabrielsouza put the code here and apparently disappeared the problem https://jsfiddle.net/mrlew/wdjc5mye/
– mrlew
You can take a look if it’s not something else?
– mrlew
Really, I’ll take a look at my code
– Gabriel Souza
Adding a div worked with your code too, but I used a simpler
– Gabriel Souza