-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FAQ section. Add toggle button examples.
- Loading branch information
Guille Paz
committed
Apr 8, 2015
1 parent
224d526
commit 6961db3
Showing
1 changed file
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
@@ -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> | ||
|
@@ -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]) | ||
|