screenfull
Advanced tools
Comparing version 2.0.0 to 3.0.0
/*! | ||
* screenfull | ||
* v2.0.0 - 2014-12-22 | ||
* v3.0.0 - 2015-11-24 | ||
* (c) Sindre Sorhus; MIT License | ||
@@ -122,3 +122,3 @@ */ | ||
get: function () { | ||
return !!document[fn.fullscreenElement]; | ||
return Boolean(document[fn.fullscreenElement]); | ||
} | ||
@@ -136,3 +136,3 @@ }, | ||
// Coerce to boolean in case of old WebKit | ||
return !!document[fn.fullscreenEnabled]; | ||
return Boolean(document[fn.fullscreenEnabled]); | ||
} | ||
@@ -139,0 +139,0 @@ } |
{ | ||
"name": "screenfull", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Simple wrapper for cross-browser usage of the JavaScript Fullscreen API, which lets you bring the page or any element into fullscreen.", | ||
@@ -10,3 +10,3 @@ "license": "MIT", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
"url": "sindresorhus.com" | ||
}, | ||
@@ -27,6 +27,15 @@ "engines": { | ||
"grunt-contrib-concat": "^0.5.0", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-contrib-uglify": "^0.6.0", | ||
"load-grunt-tasks": "^1.0.0" | ||
"grunt-contrib-uglify": "^0.10.1", | ||
"load-grunt-tasks": "^3.3.0", | ||
"xo": "*" | ||
}, | ||
"scripts": { | ||
"test": "xo" | ||
}, | ||
"xo": { | ||
"envs": [ | ||
"node", | ||
"browser" | ||
] | ||
} | ||
} |
# screenfull.js | ||
> Simple wrapper for cross-browser usage of the JavaScript [Fullscreen API](https://developer.mozilla.org/en/DOM/Using_full-screen_mode), which lets you bring the page or any element into fullscreen. Smoothens out the browser implementation differences, so you don't have too. | ||
> Simple wrapper for cross-browser usage of the JavaScript [Fullscreen API](https://developer.mozilla.org/en/DOM/Using_full-screen_mode), which lets you bring the page or any element into fullscreen. Smoothens out the browser implementation differences, so you don't have to. | ||
@@ -20,9 +20,7 @@ | ||
```sh | ||
``` | ||
$ npm install --save screenfull | ||
``` | ||
```sh | ||
$ bower install --save screenfull | ||
``` | ||
Also available on [cdnjs](https://cdnjs.com/libraries/screenfull.js). | ||
@@ -147,3 +145,13 @@ | ||
#### Fullscreen an element with Angular.js | ||
You can use the [Angular.js binding](https://github.com/hrajchert/angular-screenfull) to do something like: | ||
```html | ||
<div ngsf-fullscreen> | ||
<p>This is a fullscreen element</p> | ||
<button ngsf-toggle-fullscreen>Toggle fullscreen</button> | ||
</div> | ||
``` | ||
### Methods | ||
@@ -195,2 +203,29 @@ | ||
## FAQ | ||
### How can I navigate to a new page when fullscreen? | ||
That's not supported by browsers for security reasons. There is, however, a dirty workaround. Create a seamless iframe that fills the screen and navigate to the page in that instead. | ||
```js | ||
$('#new-page-btn').click(function () { | ||
var iframe = document.createElement('iframe') | ||
iframe.setAttribute('id', 'external-iframe'); | ||
iframe.setAttribute('src', 'http://new-page-website.com'); | ||
iframe.setAttribute('frameborder', 'no'); | ||
iframe.style.position = 'absolute'; | ||
iframe.style.top = '0'; | ||
iframe.style.right = '0'; | ||
iframe.style.bottom = '0'; | ||
iframe.style.left = '0'; | ||
iframe.style.width = '100%'; | ||
iframe.style.height = '100%'; | ||
$(document.body).prepend(iframe); | ||
document.body.style.overflow = 'hidden'; | ||
}); | ||
``` | ||
## Resources | ||
@@ -197,0 +232,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10767
239