Socket
Book a DemoInstallSign in
Socket

jquery-stickem

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-stickem

Packaging the great jquery-stickem code into an NPM module so people can find it with Yarn

1.0.3
latest
Source
npmnpm
Version published
Weekly downloads
9
-30.77%
Maintainers
1
Weekly downloads
 
Created
Source

Make items sticky as you scroll, to a point. (See Demo)

Usage

<div class="container">
	<div class="row stickem-container">
		<div class="content">
			Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
		</div>
		
		<div class="aside stickem">
		  I'm gonna be sticky!
		</div>
	</div>
</div>
.stickem-container {
  position: relative;
}

.stickit {
	margin-left: 660px;
	position: fixed;
	top: 0;
}

.stickit-end {
	bottom: 40px;
	position: absolute;
	right: 0;
}
$('.container').stickem();

Defaults

item: '.stickem'
Items that you want to stick on scroll.

container: '.stickem-container'
Container that you want the sticky item to be contained in.

stickClass: 'stickit'
Class added to the sticky item once it should start being sticky.

endStickClass: 'stickit-end'
Class added to the sticky item once it has reached the end of the container

offset: 0
Do you already have a fixed horizontal header on the page? Offset stick 'em by that many pixels.

start: 0
If your sticky item isn't at the top of the container, tell it where it should start being sticky.

onStick: null
You can create a callback function that fires when an item gets "stuck". The item gets passed back.

onUnstick: null
You can create a callback function that fires when an item gets "un-stuck". The item gets passed back.

Destroying

If you have a bunch of stuff that happens after your page has loaded (e.g. AJAX requests) that changes the height of your containers and page, and you need to "destroy" stick 'em, do it like this:

var sticky = $('.container').stickem();
sticky.destroy();

Then you can re-instantiate again if you need to.

Keywords

jQuery-Stickem

FAQs

Package last updated on 09 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.