Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 653 Bytes

README.mdwn

File metadata and controls

28 lines (19 loc) · 653 Bytes

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');
	}
});