# float-block

> It makes block stick to top of the page.

Latest version **1.2.0** (published 2019-08-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install float-block
pnpm add float-block
yarn add float-block
bun add float-block
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2019-08-09 |
| First published | 2016-11-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 26.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | a.mostovenko, o.tarasov |
| Maintainers | 041616 |

## Links

- npm: https://www.npmjs.com/package/float-block
- Repository: https://github.com/041616/float-block
- Issues: https://github.com/041616/float-block/issues
- npm.io page: https://npm.io/package/float-block

## Recent versions

- 1.2.0 (latest) — 2019-08-09
- 1.1.0 — 2017-11-22
- 1.0.6 — 2016-11-18
- 1.0.5 — 2016-11-03
- 1.0.4 — 2016-11-02
- 1.0.3 — 2016-11-02
- 1.0.2 — 2016-11-02
- 1.0.1 — 2016-11-02
- 1.0.0 — 2016-11-02

## README

# 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:

<table>
    <tr>
        <th>Name</th>
        <th>Description</th>
        <th>Type</th>
        <th>Default Value</th>
    </tr>
    <tr>
        <td>classActive</td>
        <td>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).</td>
        <td><code>string</code></td>
        <td>undefined</td>
    </tr>
    <tr>
        <td>classSticky</td>
        <td>Indicates class name that is added to block when it sticks (this class name stays on sticky block only when it become sticky).</td>
        <td><code>string</code></td>
        <td>undefined</td>
    </tr>
    <tr>
        <td>relative</td>
        <td>Indicates class name of parent block. By default block sticks to viewport top and bottom edges.</td>
        <td><code>string</code></td>
        <td>undefined</td>
    </tr>
    <tr>
        <td>top</td>
        <td>Indicates distance between viewport top edge and block top edge.</td>
        <td><code>number</code></td>
        <td>0</td>
    </tr>
    <tr>
        <td>bottom</td>
        <td>Indicates distance between viewport bottom edge and block bottom edge.</td>
        <td><code>number</code></td>
        <td>0</td>
    </tr>
    <tr>
        <td>indent</td>
        <td>Indicates distance between block bottom edge and parent block bottom edge.</td>
        <td><code>number</code></td>
        <td>0</td>
    </tr>
</table>

## Browser Support

All modern browsers and IE9+

## Examples

[Demo1](https://041616.github.io/float-block/example/demo01.html) - without any parameters.

[Demo2](https://041616.github.io/float-block/example/demo02.html) - `classActive` parameter is setted.

[Demo3](https://041616.github.io/float-block/example/demo03.html) - `top` parameter is setted.

[Demo4](https://041616.github.io/float-block/example/demo04.html) - `relative` parameter is setted.

[Demo5](https://041616.github.io/float-block/example/demo05.html) - `bottom` parameter is setted.

[Demo6](https://041616.github.io/float-block/example/demo06.html) - `classSticky` parameter is setted.

---
_Source: https://npm.io/package/float-block · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
