Answers for "sticky element on scroll js"

CSS
2

sticky operations in javascript

var siteHeader = document.getElementById('siteHeader'),
    siteNav = document.getElementById('siteNav');

    window.onscroll = function() {
        if ( siteNav.offsetTop < document.documentElement.scrollTop + 26 || siteNav.offsetTop < document.body.scrollTop + 26) {
            siteHeader.setAttribute("class","sticky");
        }
        else {
            siteHeader.setAttribute("class","");
        }
    }
Posted by: Guest on December-01-2020
0

Inner Section Sticky Scroll in elementor

.titlesticky{
position: sticky;
position: -webkit-sticky;
top: 3rem;
}
.parent-sticky 
.elementor-widget-wrap {
display: block!important; 
}
Posted by: Guest on November-02-2020

Code answers related to "sticky element on scroll js"

Browse Popular Code Answers by Language