JavaScript Library To Create Sticky Header & Footer On Scroll | titleBarJs

titleBarJs is a JavaScript library for creating header and footer sections that are displayed after a user scrolls below a certain point.

Must Read: Highly Customizable Sticky Element Plugin With JavaScript | HC-Sticky

Sticky Header & Footer On Scroll JS

Post NameFixed Header And Footer With Scrolling Content
Author Namepddivine
CategoryScrolling, Sticky
Official PageClick Here
Official Websitegithub.com
Publish DateMarch 26, 2022
Last UpdateJuly 15, 2023
DownloadLink Below
LicenseMIT

How to make use of it:

1. Import the JavaScript titlebar.js file into the webpage.

<script src="titlebar.js"></script>

2. Create the content of the sticky header and footer as follows:

<span id="titlebar">
  <p class="titlebarContent">Content Here</p>
</span>
<span id="titlebarbottom">
  <p class="titlebarContent">Content Here</p>
</span>

3. Configure the plugin with the default options.

document.addEventListener('DOMContentLoaded', main);
function main () {
  titlebarJs.init({
    isTop: true,
    id: 'titlebar',
    triggerId: 'body'
  });
  titlebarJs.init({
    id: 'titlebarbottom',
    isTop: false
  });
}

4. If you want to show the sticky header/footer after scrolling past a specific item.

function main () {
  titlebarJs.init({
    isTop: true,
    id: 'titlebar',
    triggerId: '#element'
  });
  titlebarJs.init({
    id: 'titlebarbottom',
    isTop: false
  });
}

API

titlebarJs.startTypist([options]);

  • options
    • Optional. An object to override library defaults.

Must Read: A Simple, Usable jQuery Plugin To Make A Div Sticky | stickySidebar

PropertyTypeDescriptionDefault
isTopBooleanIf true, the element is a header. If false, the element is a footer.True
idStringThe CSS id of the titlebar‘titlebar’
triggerIdStringThe CSS id of the title bar triggering elementundefined. The body tag will be used as the trigger.

See Demo And Download

fixed-header-and-footer-with-scrolling-content

Official Website(pddivine): Click Here

This superior jQuery/javascript plugin is developed by pddivine. For extra Advanced Usage, please go to the official website.

Related Posts

Google-Translate-Dropdown-Customize-With-Country-Flag

Google Translate Dropdown Customize With Country Flag | GT API

Flag google translates jQuery text that takes advantage of the Google Cloud Translation API to translate web content between languages by selecting a country from the dropdown…

Bootstrap-Fileinput

HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….

HStack-and-VStack-in-CSS

CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Leave a Reply

Your email address will not be published. Required fields are marked *