Reputation: 4162
I am creating a site with a jQuery gallery, and I have the gallery (similar to lightbox) working well. My question is, can I create a CSS "body class" that I could call from a jQuery event? This is what I want: When someone clicks on the image, the gallery appears. Then the body background becomes black, and shrinks to the size of the browser page, and the mainContent disappears only showing the image. Is there any way to add a body class to the page when a event occurs? Like:
$("div_one").click(function(){
$("body").addClass("the_new_body_css_look");
});
And the CSS:
.the_new_body_css_look {
body {
/* the colors */
}
mainContent {
/* the size */
}
}
Upvotes: 0
Views: 755
Reputation: 4888
Probably the fastest way to check it would be to try it yourself. The answer is yes you can.
Upvotes: 2