Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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","");
        }
    }
Comment

PREVIOUS NEXT
Code Example
Javascript :: v-switch vuex store 
Javascript :: javascript get line number of error 
Javascript :: add search query in express 
Javascript :: filter array in vuex 
Javascript :: mysql json change key 
Javascript :: datatable set placeholder 
Javascript :: how use replace in js for all things at once 
Javascript :: nodejs get response time 
Javascript :: jquery calc height based on width 
Javascript :: how to remove header in react navigation 
Javascript :: double datatable turbolinks issue 
Javascript :: hnazmul hassan 
Javascript :: how to get the nth child of dom js 
Javascript :: datatable without pagination 
Javascript :: javascript object to json string 
Javascript :: media query in react js 
Javascript :: ajax data and image upload laravel 
Javascript :: nodejs how cpu handle worker_threads 
Javascript :: moment + 1 day 
Javascript :: javascript create uuid 
Javascript :: asyncstorage react native 
Javascript :: de structuring value from object ES6 and javascript 
Javascript :: jquery change selected option 
Javascript :: function redirect javascript 
Javascript :: js replace all substrings 
Javascript :: Password checking regex 
Javascript :: javascript object array merge 
Javascript :: get file name nodejs 
Javascript :: nodejs execute every minute 
Javascript :: jquery observe class change 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =