https://github.com/blivesta/check-pls
For find out if the target is 'Portrait' 'Landscape' or 'Square'.
https://github.com/blivesta/check-pls
Last synced: 4 months ago
JSON representation
For find out if the target is 'Portrait' 'Landscape' or 'Square'.
- Host: GitHub
- URL: https://github.com/blivesta/check-pls
- Owner: blivesta
- Created: 2016-04-03T01:23:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-17T13:04:26.000Z (almost 9 years ago)
- Last Synced: 2025-03-09T09:32:29.326Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CheckPLS
[](https://www.npmjs.com/package/check-pls)
[](https://travis-ci.org/blivesta/check-pls)For find out if the target is 'Portrait' 'Landscape' or 'Square'.
## Install
npm
```html
$ npm install check-pls
```CDN
```html```
## Usage
```js
checkPls(element) // => string ['portrait'||'landscape'||'square']
checkPls(element, 'portrait') // => boolean
checkPls(element, 'landscape') // => boolean
checkPls(element, 'square') // => boolean```
### Example
html
```html![]()
![]()
![]()
```
use [`imagesLoaded`](http://imagesloaded.desandro.com/) `$ npm install imagesloaded````js
import imagesLoaded from 'imagesloaded'
import checkPls from 'check-pls'const elements = document.querySelectorAll('img')
const el = Array.apply(null, elements)
imagesLoaded(el, () => {
el.map((node) => {
const str = checkPls(node)
const bool = checkPls(node, 'landscape')
console.log(str)
console.log(bool)
})
})
```Result:
```js
// image-portrait.jpg
str => portrait
bool => false// image-landscape.jpg
str => landscape
bool => true// image-square.jpg
str => square
bool => false
```## License
Released under the MIT license.