angular-screenfull

WebJar for angular-screenfull

Лицензия

Лицензия

MIT
Категории

Категории

Angular Взаимодействие с пользователем Веб-фреймворки
Группа

Группа

org.webjars.bower
Идентификатор

Идентификатор

angular-screenfull
Последняя версия

Последняя версия

0.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

angular-screenfull
WebJar for angular-screenfull
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/hrajchert/angular-screenfull

Скачать angular-screenfull

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.bower/angular-screenfull/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>angular-screenfull</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/angular-screenfull/
implementation 'org.webjars.bower:angular-screenfull:0.1.0'
// https://jarcasting.com/artifacts/org.webjars.bower/angular-screenfull/
implementation ("org.webjars.bower:angular-screenfull:0.1.0")
'org.webjars.bower:angular-screenfull:jar:0.1.0'
<dependency org="org.webjars.bower" name="angular-screenfull" rev="0.1.0">
  <artifact name="angular-screenfull" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='angular-screenfull', version='0.1.0')
)
libraryDependencies += "org.webjars.bower" % "angular-screenfull" % "0.1.0"
[org.webjars.bower/angular-screenfull "0.1.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.bower : screenfull jar [2.0.0,2.1)

Модули Проекта

Данный проект не имеет модулей.

HTML5 Fullscreen API in Angular.js

Angular screenfull is a wrapper around the Screenfull library, that allows you to use the HTML5 fullscreen API, in "the Angular way".

You can see the API documentation with some demo examples.

Install

Download via npm or look for the files in the dist folder

$ npm install --save angular-screenfull

Import it to your page

<script src="node_modules/screenfull/dist/screenfull.js"></script>
<script src="node_modules/angular-screenfull/dist/angular-screenfull.min.js"></script>

You need to have both screenfull and angular-screenfull loaded in the browser in order to the directive to work. I have a an agular.js project using a custom loader, but if you want to add webpack support, PR's are welcomed.

Enable it on your app

angular.module('myModule', ['angularScreenfull']);

Use it

In its simplest form, you can do something like this

<div ngsf-fullscreen>
    <p>This is a fullscreen element</p>
    <button ngsf-toggle-fullscreen>Toggle fullscreen</button>
</div>

The ngsf-fullscreen indicates which element is going to be the fullscreen element and the ngsf-toggle-fullscreen will toggle the fullscren when clicked.

Note that you can have multiple ngsf-fullscreen elements living side by side, the other directives will use the closest parent controller.

A word in CSS

When the element that uses directive ngsf-fullscreen becomes fullscreen a class is added using the $animation service, so you can add animations to the transition.

Note that this library doesn't come with any CSS, so if you would like your element to occupy the whole screen (and I imagine that you want to), you should add something like this to your CSS.

.fullscreen {
    width: 100%;
    height: 100%;
}

Export its functionality

You can also expose the element controller trough its directive name. So for example you can achieve the same result using this

<div ngsf-fullscreen="fullscreenCtrl">
    <p>This is another fullscreen element</p>
    <button ng-click="fullscreenCtrl.toggleFullscreen()">Toggle fullscreen</button>
</div>

Show or hide

We also provide directives to show the elements based on the fullscreen status, so for example you can have this

<div ngsf-fullscreen>
    <p>This is yet another fullscreen element</p>
    <a ngsf-toggle-fullscreen show-if-fullscreen-enabled>
        <i show-if-fullscreen=false>Icon for enter fullscreen</i>
        <i show-if-fullscreen=true>Icon for exit fullscreen</i>
    </a>
</div>

The problem with F11

As stated in this bug, it appears that browser vendors don't allow a user script to tap into the F11 hotkey for security reasons. That means that we can only detect that the page is in fullscreen mode when the HTML5 fullscreen API is used.

If you can find a way to overcome this problem please let me know!

Версии библиотеки

Версия
0.1.0