From 6961db336481e7fd13f9a6e235ae85c8fdeaea97 Mon Sep 17 00:00:00 2001 From: Guille Paz Date: Wed, 8 Apr 2015 09:53:28 -0300 Subject: [PATCH] Add FAQ section. Add toggle button examples. --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e8831b..cd40cb1 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ Then you just include Slideout.js and create a new instance with some options:
- +

Panel

@@ -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(); + }); @@ -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: [guille87paz@gmail.com](mailto:guille87paz@gmail.com)