float-block

1.2.0 • Public • Published

float-block

It makes block stick to top of the page.

To use it, block must corresponds CSS rules:

  • position: static;
  • margin: 0;
  • display: block;
  • width: auto;
  • float: none;

Options

Options list:

Name Description Type Default Value
classActive Indicates class name that is added to block when it become active (this class name stays on sticky block even it reach bottom edge of the container). string undefined
classSticky Indicates class name that is added to block when it sticks (this class name stays on sticky block only when it become sticky). string undefined
relative Indicates class name of parent block. By default block sticks to viewport top and bottom edges. string undefined
top Indicates distance between viewport top edge and block top edge. number 0
bottom Indicates distance between viewport bottom edge and block bottom edge. number 0
indent Indicates distance between block bottom edge and parent block bottom edge. number 0

Browser Support

All modern browsers and IE9+

Examples

Demo1 - without any parameters.

Demo2 - classActive parameter is setted.

Demo3 - top parameter is setted.

Demo4 - relative parameter is setted.

Demo5 - bottom parameter is setted.

Demo6 - classSticky parameter is setted.

Readme

Keywords

none

Package Sidebar

Install

npm i float-block

Weekly Downloads

20

Version

1.2.0

License

ISC

Unpacked Size

27.3 kB

Total Files

7

Last publish

Collaborators

  • 041616