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

https://github.com/nju33/mohill

💄 Hill-shaped modal element
https://github.com/nju33/mohill

library modal pure-javascript

Last synced: 4 months ago
JSON representation

💄 Hill-shaped modal element

Awesome Lists containing this project

README

          

# Mohill

💄 Hill-shaped modal element

![screenshot](https://github.com/nju33/mohill/raw/master/images/screenshot.gif?raw=true)

## Install or Download

```sh
yarn add mohill
npm i -S mohill
```

Or access to [releases page](https://github.com/nju33/mohill/releases).
Then, download the latest version.

## Usage

First, if you read as a separate file

```html

```

Please specify `id` for children of target element.
It will be used when opening.

```html







...



```

For example, if you want to set an event for an element in `#foo`, please set it before creating Mohill instance.

```js
import Mohill from 'mohill';

document.getElementById('close-button').addEventListener('click', () => {
mohill.close();
});

const mohill = new Mohill({
target: getElementById('target'),
data: {
style: {
// defaults
height: '70vh',
width: '70%',
coverBackgroundColor: 'rgba(0,0,0,.4)',
backgroundColor: '#222',
borderRadius: '6px'
}
}
});

document.getElementById('foo-trigger').addEventListener('click', () => {
mihill.open('foo');
});

document.getElementById('bar-trigger').addEventListener('click', () => {
// If you want to change the style
mihill.setStyle({backgroundColor: '#ccc'});
mihill.open('bar');
});
```

### Example

- `test/fixtures/index.js`
- `example/webpack/index.js`

## LICENSE

The MIT License (MIT)

Copyright (c) 2017 nju33