<script>
window.onscroll = function() {myFunction()};
var header = document.getElementById("nav-main-container");
var sticky = header.offsetTop;
function myFunction() {
if (window.pageYOffset > sticky) {
header.classList.add("sticky");
} else {
header.classList.remove("sticky");
}
}
</script>
<script>
var parallax = document.querySelectorAll(".parallax");
var
speed = -0.25;
window.onscroll = function() {
[].slice.call(parallax).forEach(function(el, i) {
var windowYOffset = window.pageYOffset,
elBackgrounPos = "100% " + (windowYOffset * speed + i * 500) + "px";
el.style.backgroundPosition = elBackgrounPos;
});
};
</script>
I have used above both code in footer but sticky code is not working
can u please give me solution