An open API service indexing awesome lists of open source software.

https://github.com/mattmoony/peekaboojs

A JavaScript plugin that enables you to display more information without taking up more space. Users simply need to hover over a certain text element to be presented with a stylish message. 🙈
https://github.com/mattmoony/peekaboojs

css easy framework hinting html info information javascript js peekaboo peekaboojs popup

Last synced: 3 months ago
JSON representation

A JavaScript plugin that enables you to display more information without taking up more space. Users simply need to hover over a certain text element to be presented with a stylish message. 🙈

Awesome Lists containing this project

README

        

![GitHub release](https://img.shields.io/github/release/MattMoony/PeekabooJS.svg) ![GitHub last commit](https://img.shields.io/github/last-commit/MattMoony/PeekabooJS.svg) ![GitHub All Releases](https://img.shields.io/github/downloads/MattMoony/PeekabooJS/total.svg) ![GitHub repo size in bytes](https://img.shields.io/github/repo-size/MattMoony/PeekabooJS.svg) ![GitHub](https://img.shields.io/github/license/MattMoony/PeekabooJS.svg)

# PeekabooJS
_Where's the info? There's the info!_

---

Add necessary information to your HTML-Elements. Watch the information magically appear in a little info-popup pointing to the element-in-question. It is an interesting way to gain the user's attention and give him additional intel.

## Installation

#### Script tag

```html

```

## Setup

No additional setup required. All you have to do is include the script in your HTML document.

## Usage

#### Parse all

In order to have a _peekaboo-popup_ appear, whenever a user hovers over a certain element, you just need to use the `` HTML tag around any text/element.

To specify the information that will show up, use the `info` attribute.

```html


Some random text.
However, I want you to know this!

```

Now, just creating the element doesn't create a popup just yet. However, all you need to do now, is, to call the `Peekaboo.parse()` function in your JavaScript code.

```javascript
// ...

Peekaboo.parse();

// ...
```

![Example 0](./media/ex0.gif)

#### Parse children

If you decide to asynchronosly load content into your page, or for any other reason, you might only want to parse certain parts of the webpage. You can do this by just passing the parent element, whose children should be parsed, to the `Peekaboo.parse(parent)` function.

```html


something, something



Some random text.
However, I want you to
know this!


```

```javascript
// ...

Peekaboo.parse(document.getElementById('parent'));

// ...
```

#### Reposition

In order for the info-popups to always be in the right position, you should call the `Peekaboo.reposition()` which will re-align all, already created, _peeker_ elements.

```javascript
// ...

window.onresize = () => {
Peekaboo.reposition();

// ...
}

// ...
```

## Conclusion

For any further questions & suggestions, you can message me on [twitter](https://twitter.com/Matthia23184857).

---

_... Matthias M. (March, 2019)_