CSS/jQuery Based on empty sidebars

CSS/jQuery Based on empty sidebars

by Danny Avery -
Number of replies: 1

I am trying to add classes via jQuery when the (sidebars), side-pre & side-post, both are out, and when either one of them is out. Can anyone tell me  the best way to do this? Here's what I've been trying to no avail:


if ( $( "body" ).hasClass( "empty-region-side-pre" ) || $( "body" ).hasClass( "empty-region-side-post" ) ) {

            alert("Hello World");

            $('.grid').css("background", "red");

};


This is just an example of the many things I've tried. I noticed also that nothing happens when the body has this class added, i.e. when a change is made. Do I need a click function or something?

Thanks in advance,

Danny

Average of ratings: -
In reply to Danny Avery

Re: CSS/jQuery Based on empty sidebars

by Danny Avery -

No worries, I figured it out with the classes added to the body tag. Thanks!