Merge remote-tracking branch 'origin/master'

This commit is contained in:
Angelos Chalaris
2017-12-29 00:18:58 +02:00
5 changed files with 92 additions and 0 deletions

13
snippets/hide.md Normal file
View File

@ -0,0 +1,13 @@
### hide
Hides all the elements specified.
Use the spread operator (`...`) and `Array.forEach()` to apply `display: none` to each element specified.
```js
const hide = (...el) => [...el].forEach(e => (e.style.display = 'none'));
```
```js
hide(document.querySelectorAll('img')); // Hides all <img> elements on the page
```

13
snippets/show.md Normal file
View File

@ -0,0 +1,13 @@
### show
Shows all the elements specified.
Use the spread operator (`...`) and `Array.forEach()` to clear the `display` property for each element specified.
```js
const show = (...el) => [...el].forEach(e => (e.style.display = ''));
```
```js
show(document.querySelectorAll('img')); // Shows all <img> elements on the page
```