Togglecss except on some Ivs

Asked

Viewed 12 times

0

I have the following problem: I have a js that adds a certain style in a div or whole html. I would like to know how to ignore some Ivs so that this style is not added to them. Follow the code I am using:

 $('#efeito').click(function (e) {
        $('html').toggleClass('efeito-pagina');
        e.preventDefault();
 });

That way, I don’t want to ignore just two Ivs whose id are #banners-rodape and #caixa-informativo

1 answer

0

Hello, you can use a class you will receive this event

<div class="EfeitoPagina"></div>
<div></div>
<div class="EfeitoPagina"></div>
<div class="EfeitoPagina"></div>
<div></div>
<div class="EfeitoPagina"></div>

<script>
    $(function(){
        $('#efeito').click(function (e) {
            $('.EfeitoPagina').toggleClass('efeito-pagina');
            e.preventDefault();
         });
    });
</script>

So only div’s that have the class "Efeitopagina" will be affected

Browser other questions tagged

You are not signed in. Login or sign up in order to post.