Jump to content

Enable and disable css class with javascript


impts

Recommended Posts

The problem is the following, I have a static header and when the user scrolls down, I want it to be fixed and when it goes back up, it goes back to being static. Below are the classes.

 

#header {
  box-sizing: border-box;
  width: 100%;
  position: static;
  top: 0;
  height: 50px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid #ddd;
}

 

 

 

.header {
position: fixed;
background: rgba(255, 255, 255, 0.35);
backdrop-filter: blur(7px);
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...