Can’t do Transparent header using JS & CSS
-
I’m trying to do transparent header and I found this code online:
CSS:
body {
min-height:800px;
}
.ehf-header header {
z-index: 30;
position: fixed;
width: 100%;
top: 0;
}
.changebackground{
background-color:white;
transition: background 500ms ease-out;
}JS:
jQuery(window).ready(function() {
jQuery(window).scroll(function() {
var scroll = jQuery(window).scrollTop();
if (scroll > 100) {
jQuery(“header”).addClass(“changebackground”);
} else {
jQuery(“header”).removeClass(“changebackground”);
}
});
});The developer online said: to change the class to my header class, which his: #masthead
so I switched the “header” in JS to “#masthead”P.S: the css code that do the Sticky style worked, only the transparent didn’t.
The topic ‘Can’t do Transparent header using JS & CSS’ is closed to new replies.