Pregunta

I have this js code,

EDIT: Forgot to mention, i have this fadeIn when the iframe loads

$('iframe').on('load', function(){
muteVideo();
playVideo();
$(this).fadeIn();
$('.ligarsom').fadeIn();
setTimeout(function() {$('.ligarsom').fadeOut()}, 20000);
});

and this

<script>
$(document).ready(function(){
$('.ligarsom').on('click', function(){
$('.ligarsom').fadeOut(1000);
});
}); 
</script>

and this html

<div class="ligarsom" style="display:none;"></div>

When i use style="visibility:hidden" the div doesn't even appear. And like above fadeOut doesn't work as it should, there is no animation, it just hides abruptaly. Is there anything wrong in my code?

See it in action in: www.finecolor.com.br/novo

¿Fue útil?

Solución

Problem: transition: is conflicting with fadOut() Function animation.

Solution: Add this to your css:

.ligarsom, .ligarsom:hover{
    transition: none;
}

Otros consejos

This should work in this way

HTML

<div class="ligarsom">click here</div>

jquery

$(document).ready(function() {
$(".ligarsom").click(function() {

    $(this).fadeOut(100);

});

});

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top