Skip to content

Commit

Permalink
Add FAQ section. Add toggle button examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
Guille Paz committed Apr 8, 2015
1 parent 224d526 commit 6961db3
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Then you just include Slideout.js and create a new instance with some options:

<main id="panel">
<header>
<button>☰</button>
<button class="toggle-button">☰</button>
<h2>Panel</h2>
</header>
</main>
Expand All @@ -167,6 +167,11 @@ Then you just include Slideout.js and create a new instance with some options:
'padding': 256,
'tolerance': 70
});
// Toggle button
document.querySelector('.toggle-button').addEventListener('click', function() {
slideout.toggle();
});
</script>

</body>
Expand Down Expand Up @@ -249,6 +254,22 @@ $ npm test
$ npm run hint
```

## FAQ

### How to add a toggle button.

```js
// vanilla js
document.querySelector('.toggle-button').addEventListener('click', function() {
slideout.toggle();
});

// jQuery
$('.toggle-button').on('click', function() {
slideout.toggle();
});
```

## With ❤ by
- Guille Paz (Front-end developer | Web standards lover)
- E-mail: [[email protected]](mailto:[email protected])
Expand Down

0 comments on commit 6961db3

Please sign in to comment.