Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to fix header on scroll

as per https://sigmascripts.com/how-to-fix-header-on-scroll/ 

<div id="header" class="big_header"> <p>TalkersCode Sticky Header</p> </div>

<script>
$(window).scroll(function()
 {
 if ($(this).scrollTop() > 1)
 {
 $('#header').addClass("sticky_header");
 }
 else
 {
 $('#header').removeClass("sticky_header");
 }
 });
</script>
Comment

css static header on scroll

table thead,
table tfoot {
  position: sticky;
}
table thead {
  inset-block-start: 0; /* "top" */
}
table tfoot {
  inset-block-end: 0; /* "bottom" */
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: nodejs mysql insert query 
Javascript :: aos animation angular 
Javascript :: reverse a word javascript 
Javascript :: html2canvas angular 
Javascript :: call laravel route js 
Javascript :: enter only numbers in input field angular 
Javascript :: compare two dates using moment 
Javascript :: fetching iframe content JS 
Javascript :: javascript minimum number in array 
Javascript :: javascript disable resize window 
Javascript :: How to write inside a div using javascript 
Javascript :: npm auth0-react 
Javascript :: jquery add multiple classes 
Javascript :: new line in react js 
Javascript :: javascript remove all spaces 
Javascript :: get value of ajax success in variable 
Javascript :: how to reset node command prompt 
Javascript :: chart.js chart is not defined 
Javascript :: show hide more text jquery 
Javascript :: javascript array push middle 
Javascript :: javascript split by backslash 
Javascript :: javascript contains substring 
Javascript :: how to add variables to an array 
Javascript :: get text from selected select javascript object 
Javascript :: convert string to number javascript 
Javascript :: jquery set inner text 
Javascript :: javascript check how many times value in array 
Javascript :: jquery target partial id 
Javascript :: chrome.tab.onupdated 
Javascript :: deprecation warning: value provided is not in a recognized rfc2822 or iso format. moment construction falls back to js date(), which is not reliable across all browsers and versions 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =