ToggleCss except on some divs

0

I have the following problem: I have a js that adds a particular style to a div or whole html. I would like to know how to ignore some divs so that this style would not be added to them. Here is the code I'm using:

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

This way, I do not want to ignore just two divs whose id is #banners-rodape and #caixa-informativo

    
asked by anonymous 18.03.2016 / 13:53

1 answer

0

Hello, you can use a class that 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 the div's that have the class "PageEffect" will be affected

    
18.03.2016 / 14:18