Answer the question
In order to leave comments, you need to log in
What method should be used in JS code to make the block appear smooth on hover?
$('.portfolio-rhombs, .portfolio-rhomb').on( "mouseenter", function() {
$(this).find('.portfolio-rhombs__view, .portfolio-rhomb__view').css({
"display": "none"
});
$(this).find('.portfolio-rhombs__modal, .portfolio-rhomb__modal').css({
"display": "block"
});
});
$('.portfolio-rhombs, .portfolio-rhomb').on( "mouseleave", function() {
$(this).find('.portfolio-rhombs__modal, .portfolio-rhomb__modal').css({
"display": "none"
});
$(this).find('.portfolio-rhomb__view').css({
"display": "block"
});
$(this).find('.portfolio-rhombs__view').css({
"display": "grid"
});
})
Answer the question
In order to leave comments, you need to log in
<div id="block">hover me</div>
function getHidden (hide , seconds , animation) {
block.setAttribute('style',`
width:100px;
height: 50px;
cursor:pointer;
background: ${hide ? "red" : "none"};
transition: ${seconds}s ${animation};
`)
}
block.addEventListener('mouseover' , () => getHidden(true,1,"ease-in") )
block.addEventListener('mouseout' , () => getHidden(false,1,"ease-out") )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question