Skip to content

kudago/sticky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sticky

Position:sticky that works.

$ npm install --save component-sticky

var Sticky = require('component-sticky');

var sticky = new Sticky(document.querySelector(".sticky-element"), {
	...
});

Options

offset: 0

How many pixels to skip from the top

within: parent

Any element, element selector or bounding box like {top: 0, bottom: 100 } or { top: element, bottom: element }

stickyClass: 'is-stuck'

Class to add when element is sticked

stubClass: 'sticky-stub'

Class to add to a spacer (placeholder when element is stuck)

bottomClass: 'is-bottom'

When element is parked bottom

topClass: 'is-top'

When element is parked on top

stack: null

Name of a group to stack elements within. undefined stack won’t relate element to any group

API

aticky.recalc()

Update position, sizes, sticking. Automatically called on window resize.

sticky.disable()

Unhook sticky controller from element. Called automatically when element is removed.

sticky.enable(

Enable previously disabled sticky element.

NPM

Releases

No releases published

Packages

No packages published