Skip to content

Commit

Permalink
Update fullscreen module
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinchoolur committed Feb 23, 2019
1 parent 6b42444 commit 9f6b119
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
20 changes: 13 additions & 7 deletions demo/js/lg-fullscreen.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**!
* lg-fullscreen.js | 1.0.0 | October 5th 2016
* lg-fullscreen.js | 1.1.0 | February 23rd 2019
* http://sachinchoolur.github.io/lg-fullscreen.js
* Copyright (c) 2016 Sachin N;
* @license GPLv3
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgFullscreen = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgFullscreen = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
Expand Down Expand Up @@ -37,6 +37,10 @@
fullScreen: true
};

function isFullScreen() {
return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
}

var Fullscreen = function Fullscreen(element) {

this.el = element;
Expand Down Expand Up @@ -102,18 +106,20 @@
});

utils.on(this.core.outer.querySelector('.lg-fullscreen'), 'click.lg', function () {
if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
_this.requestFullscreen();
} else {
if (isFullScreen()) {
_this.exitFullscreen();
} else {
_this.requestFullscreen();
}
});
};

Fullscreen.prototype.destroy = function () {

// exit from fullscreen if activated
this.exitFullscreen();
if (isFullScreen()) {
this.exitFullscreen();
}

utils.off(document, '.lgfullscreen');
};
Expand All @@ -122,4 +128,4 @@
});

},{}]},{},[1])(1)
});
});
4 changes: 2 additions & 2 deletions demo/js/lg-fullscreen.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9f6b119

Please sign in to comment.