How to remove a css class using jquery on just one screen? is not working

Asked

Viewed 15 times

0

I want to use this class throughout the layout of the site, except on the main screen because there is an image that needs to stay at the top, ie(padding-top: 0px).

Class I need to remove on a screen:

body {
padding-top: 50px;
padding-bottom: 20px;
}        

Function jQuery I created to do this and it didn’t work.

$(document).ready(function () {
$("#intro").removeClass("body");
});

NOTE: intro is the image id that at the top(0px)

1 answer

0


You are using a reserved word for a class, the correct is to add a point at the beginning of the declaration, because the css is interpreting as if it were the body element of the HTML.

Do that which should work, note that I just added one .(point) at the beginning.

.body {
   padding-top: 50px;
   padding-bottom: 20px;
}
  • Thanks Ramiressss!! do not study css, would not imagine that it was just that

  • Not at all. It’s good to know that we can help in some way.

Browser other questions tagged

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