# autotoptooltip

> Automatically change position of Tooltip.js tolltips based on window width.

Latest version **0.1.0** (published 2016-04-12) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-04-12 |
| First published | 2016-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Zach Leigh |
| Maintainers | zachleigh |
| Keywords | tooltip, tooltip.js |

## Links

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

## Recent versions

- 0.1.0 (latest) — 2016-04-12

## README

# AutoTopTooltip   
  
##### Automatically change the position of [Tooltip.js](https://github.com/HubSpot/tooltip) tooltips based on window width.

### Quick Guide
  - [Install](#install)
  - [Usage](#usage)

## Install
First install tooltip.js. See [here](https://github.com/HubSpot/tooltip) for info.    
Download the autotoptooltip min.js file or install through npm:
```
npm install autotoptooltip --save
```

## Usage
When creating tooltips, set the data-tooltip-position to 'top auto'.
```html
<a data-tooltip="content" data-tooltip-position="top auto">Text</a>
```
   
Include the min.js file in your js somewhere.    
    
New up a AutoTopTooltip.js instance passing it an object of screen-width/pixel-limit key/value pairs.
```js
new AutoTopTooltip({425: 80, 800: 220, 1200: 400});
```
The passed screen-width/pixel-limit values mean that at the defined **screen-width**, tooltips that occur in **pixel-limit** pixels or less from the screen edge will have their position changed. For example, in the above instance, if the screen-width is less than 425 pixels, tooltips that occur 80 pixels or less away from the screen edge will have their position changed to either 'top left' or 'top right'. All other tooltips will have positions set to 'top center'.   
    
A default limit can be sent as the second parameter to the constructor.
```js
new AutoTopTooltip({425: 70, 800: 180, 1000: 300}, 600);
```
If not passed, this value will default to 500px.

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