Travis build: 442

This commit is contained in:
Travis CI
2017-12-28 22:04:46 +00:00
parent 8147c68197
commit 5537b6dc58
4 changed files with 66 additions and 2 deletions

View File

@ -91,9 +91,11 @@
* [`elementIsVisibleInViewport`](#elementisvisibleinviewport)
* [`getScrollPosition`](#getscrollposition)
* [`getURLParameters`](#geturlparameters)
* [`hasClass`](#hasclass)
* [`httpsRedirect`](#httpsredirect)
* [`redirect`](#redirect)
* [`scrollToTop`](#scrolltotop)
* [`toggleClass`](#toggleclass)
</details>
@ -1762,6 +1764,29 @@ getURLParameters('http://url.com/page?name=Adam&surname=Smith'); // {name: 'Adam
[⬆ Back to top](#table-of-contents)
### hasClass
Returns `true` if the element has the specified class, `false` otherwise.
Use `element.classList.contains()` to check if the element has the specified class.
```js
const hasClass = (el, className) => el.classList.contains(className);
```
<details>
<summary>Examples</summary>
```js
hasClass(document.querySelector('p.special'), 'special'); // true
```
</details>
[⬆ Back to top](#table-of-contents)
### httpsRedirect
Redirects the page to HTTPS if its currently in HTTP. Also, pressing the back button doesn't take it back to the HTTP page as its replaced in the history.
@ -1835,6 +1860,29 @@ scrollToTop();
</details>
[⬆ Back to top](#table-of-contents)
### toggleClass
Toggle a class for an element.
Use `element.classList.toggle()` to toggle the specified class for the element.
```js
const toggleClass = (el, className) => el.classList.toggle(className);
```
<details>
<summary>Examples</summary>
```js
toggleClass(document.querySelector('p.special'), 'special'); // The paragraph will not have the 'special' class anymore
```
</details>
[⬆ Back to top](#table-of-contents)
## Date