Skip to content

midned/Sticky.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Sticky.js

Stick elements to the viewport, being able to change its behavior after and before it sticks

Usage

It's really simple you won't see any $() here

// You don't need me to say that you should have some html for the demo and include the script, do you?

var aside = document.getElementsByTagName('aside');
// You can use any other native selector, like getElementById, querySelector, etc.

new Sticky(aside, {
	//margin: 5, // margin (in pixels) with the top of the viewport

	stick: function(){
		console.log("It's following you now");
	},
	unstick: function() {
		console.log('Back to normal');
	}
});

About

Stick elements to the viewport

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published