# occamy

> the occamy grows or shrinks in order to fit available space

Latest version **1.0.2** (published 2018-10-17) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install occamy
pnpm add occamy
yarn add occamy
bun add occamy
```

## 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.0.2 |
| Published | 2018-10-17 |
| First published | 2018-10-15 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 27.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | yetzt |
| Maintainers | yetzt |
| Keywords | occamy, layout, tiles |

## Links

- npm: https://www.npmjs.com/package/occamy
- Repository: https://github.com/yetzt/occamy
- Homepage: https://github.com/yetzt/occamy#readme
- Issues: https://github.com/yetzt/occamy/issues
- npm.io page: https://npm.io/package/occamy

## Recent versions

- 1.0.2 (latest) — 2018-10-17
- 1.0.1 — 2018-10-15
- 1.0.0 — 2018-10-15

## README

# Occamy

> *The Occamy grows or shrinks in order to fit available space.*

![occamy example](example/example.png)

Occamy aranges and scales all elements within a containter element to fit available space while keeping the elements relative size and aspect ratio close. It's pure plain vanilla JS and less than 1.6K in size when gzipped.

## Usage

``` javascript
var occ = occamy(container, options[, dom]);
```

The container Element can eiter be an instance of `HTMLElement` or a Ouery Selector like `'#container'`.

If you use Occamy from node.js, pass your `window.document` as third parameter;

## Options 

* `dir`: *`row`* or *`col`* for row or column layout; omit for autopilot.
* `prefix`: alternative prefix for `occamy-item` css elements
* `gap`: gap between elements in pixels

### Instance Methods

#### occamy.redraw()

Rearrange elements.

``` javascript
var occ = occamy('#container');
window.addEventListener("resize", function(){
	occ.redraw();
});
```

#### occamy.destroy()

Remove occamy.

``` javascript
var occ = occamy('#container');
document.addEventListener('keydown', function(evt){
	if (27 === evt.keyCode) occ.destroy();
});
```

## Example

See [Demo](example/demo.html)

## License

[Unlicense](http://unlicense.org/UNLICENSE)

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