2.1.0 • Published 7 years ago

faded-header v2.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

faded-header

Change the color of an element based on how far the page has scrolled.

Intended to fade in a fixed header as a visitor scrolls down.

Will transform from any (or no) initial colors to any colors parseable by the excelent color library.

See index.html for usage example.

Arguments

fadedHeader(headerSelector, {
	// Default values below
	transformRange: window.innerHeight, // Page window.scrollY at which should be fully transformed
	backgroundColor: null, // Background color to transform to
	textColor: null, // Text color to transform to
	easingFunction: ratio => Math.pow(ratio, 2), // Easing function for the scrolled ratio. Number between 0 and 1 goes in and a number between 0 and 1 should come out
	backgroundEasingFunction: null, // Overrides easingFunction for background if set
	textEasingFunction: null // Overrides easing function for text if set
});

If neither backgroundColor nor textColor are passed, will just log and return without doing anything.

transformRange, backgroundColor, and textColor can be arrays.

2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago