A simple jQuery extension to make any HTML element sticky on scroll.

Overview

jquery.sticky.js

A simple jQuery extension to make any HTML element sticky on scroll.

Installation

Just download the script and include it in your HTML:

<script type="text/javascript" src="path/to/jquery.sticky.js"></script>

Example

Here's how easy to make any element sticky:

<script type="text/javascript">
	jQuery('.your-element').sticky();
</script>

With additional offset

jQuery('.your-element').sticky({
	offsetY: 50
});

With outerWidth

jQuery('.your-element').sticky({
	offsetY: 50,
	outerWidth: true
});

Destroy

jQuery('.your-element').sticky('destroy');

Options

  • offsetY (number) - Additional vertical offset. default: 0
  • outerWidth (boolean) - Whether to use element's outerWidth or normal width. default: false
  • zIndex (number) - To make sticky element overlap other elements. default: 99
  • cssClass (string) - A custom CSS class to apply on sticky element on scroll. default: element-sticky
You might also like...

JavaScript micro-library: pass in an element and a callback and this will trigger when you click anywhere other than the element

Add a click listener to fire a callback for everywhere on the window except your chosen element. Installation run npm install @lukeboyle/when-clicked-

May 13, 2021

a VS Code Extension for Easily Localize any blade/php text in any Laravel project.

a VS Code Extension for Easily Localize any blade/php text in any Laravel project.

Laravel Easy Localize a VS Code Extension for Easily Localize any blade/php text in any Laravel project. Features Custom array key for each translatio

Oct 31, 2022

📝 You Can Create Your Own Short Notes With The Help of Sticky-Notes Website.

Hi 👋 , I'm Sneh Agrawal A passionate Web developer from India 🔭 I’m currently working on Chatting Website Chit-Chat 📫 How to reach me on My Gmail A

Feb 23, 2022

Show floating sticky outline (table of contents) for Notion pages, powered by nbundle.

Notion Outline Show floating sticky outline (table of contents) for Notion pages, powered by nbundle. This is an nbundle-powered Notion app bootstrapp

Nov 10, 2022

Automatically make same-page links scroll smoothly

Automatically make same-page links scroll smoothly

Smooth Scroll Plugin Allows for easy implementation of smooth scrolling for same-page links. Note: Version 2.0+ of this plugin requires jQuery version

Dec 25, 2022

Eth-explorers-extension - Chrome extension to open Ethereum addresses & transaction hash from any page on popular explorers + dashboards

Eth-explorers-extension - Chrome extension to open Ethereum addresses & transaction hash from any page on popular explorers + dashboards

eth-explorers-extension(s) This repository contains two folders with two extensions that work for address and transactions respectively. 1. eth-addres

Jan 6, 2023

Javascript library for switching fixed elements on scroll through sections. Like Midnight.js, but without jQuery

Library for Switching Fixed Elements on Scroll Sometimes designers create complex logic and fix parts of the interface. Also they colour page sections

Sep 19, 2022

infiniteScrollWithTemplate - JQuery plugin for ajax-enabled infinite page scroll / auto paging with template

jQuery Infinite With Template Plugin JQuery plugin for ajax-enabled infinite page scroll with template. If you like jQuery until now, this little libr

Mar 19, 2021

Pin any element within a container

jQuery.pin Ever wanted to pin something to the side of a text? Ever needed a subtle sticky element to quietly hang around as you scroll down? Jquery.P

Nov 30, 2022
Owner
Achal Jain
Full Stack Developer
Achal Jain
Create sticky element in flexbox sidebars. it can use in Vanilla JS and frameworks like Vue and React

js sticky side simple sticky side with js that can use in frameworks like vue and react. notes it can be used just in flexbox grids. target element sh

milad nazari 10 Mar 3, 2022
A tiny JavaScript library to easily toggle the state of any HTML element in any contexts, and create UI components in no time.

A tiny JavaScript library to easily toggle the state of any HTML element in any contexts, and create UI components in no time. Dropdown, navigation bu

Matthieu Bué 277 Nov 25, 2022
A jQuery plugin allowing you to scroll an image within a container element

jQuery Scroll Image Inside v0.1 A jQuery plugin allowing you to scroll an image within a container element Usage <div id="window"> <img src="reall

Derek Ashauer 1 Apr 11, 2021
jQuery Plugin for Sticky Objects

Sticky Sticky is a jQuery plugin that gives you the ability to make any element on your page always stay visible. Sticky in brief This is how it works

Anthony Garand 3.3k Dec 16, 2022
Customizable sticky notes for the web. jQuery plugin

Post It All! Customizable sticky notes for the web. jQuery Plugin The jQuery plugin for adding sticky notes in your webpage. http://postitall.txusko.c

Javi Filella 51 Apr 17, 2022
Canvas-based JavaScript UI element implementing touch, keyboard, mouse and scroll wheel support.

pure-knob Initially a (circular) knob / dial control with mouse, wheel, touch and keyboard support, implemented in pure JavaScript. In addition, this

Andre Plötze 44 Nov 4, 2022
A small jQuery plugin for rendering scroll-based HTML animations

Storyline Build beautiful landing pages that change as the user scrolls up or down. Project created in 2013 and ported to GitHub in 2021. Demo Just vi

Mark Jivko 3 May 30, 2022
adds the *scrollin* and *scrollout* events to jquery, which will fire when any given element becomes (respectively) visible and invisible in the browser viewpori

jQuery.scrolling This plugin adds the scrollin and scrollout events to jquery: these events will fire when any given element becomes visible/invisible

Dark 5 Apr 7, 2021
Little Alpine.js plugin to add a typewriter effect to any HTML element.

⌨️ Alpine Typewriter ⌨️ An Alpine.js plugin to add a typewriter effect to any HTML element. ?? Installation CDN Include the following <script> tag in

Marc Reichel 58 Dec 28, 2022
A Simple jQuery Plugin for Animating Scroll

AnimateScroll A Simple jQuery Plugin for Animating the Scroll Demo can be seen at http://plugins.compzets.com/animatescroll What is it exactly? Animat

Ram 714 Jul 21, 2022