summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Häggqvist <[email protected]>2016-01-17 00:04:25 +0100
committerVictor Häggqvist <[email protected]>2016-01-17 00:04:25 +0100
commitc257743ec6bfb98e32aa2d87d3e8389a3bc37a31 (patch)
tree3df0b8c38fe41d8f7b0e28aad2494fe884355270
parent515c898a8e0420dfcbee7d983c82094f06e08134 (diff)
--git-dir=../.gitgh-pages
515c898
-rw-r--r--LightBox.Core.js10
-rw-r--r--index.html85
-rw-r--r--touch-imagelightbox.js1214
3 files changed, 51 insertions, 1258 deletions
diff --git a/LightBox.Core.js b/LightBox.Core.js
index a39d2a9..f3f369b 100644
--- a/LightBox.Core.js
+++ b/LightBox.Core.js
@@ -64,7 +64,7 @@ var LightBox = LightBox || {}; LightBox["Core"] =
var log = __webpack_require__(3);
- log.setDefaultLevel(log.levels.DEBUG);
+ //log.setDefaultLevel(log.levels.DEBUG);
var LightBox = function () {
function LightBox(targetSelector) {
@@ -188,7 +188,13 @@ var LightBox = LightBox || {}; LightBox["Core"] =
key: 'onImageClick',
value: function onImageClick(event) {
log.debug(event);
- var element = event.srcElement.parentElement;
+ var srcElement = event.srcElement;
+
+ if (srcElement === undefined) {
+ srcElement = event.originalTarget;
+ }
+
+ var element = srcElement.parentElement;
if (!this.isTargetValid(element)) return true;
event.preventDefault();
diff --git a/index.html b/index.html
index d1e167c..34be1c2 100644
--- a/index.html
+++ b/index.html
@@ -19,6 +19,7 @@
<header>
<h1>Image Lightbox<span>Responsive & Touch-Friendly</span></h1>
<p>View source of demos on <a href="https://github.com/victorhaggqvist/touch-imagelightbox/tree/gh-pages">Github</a>.</p>
+ <p style="color: #353535; font-size: 13px;">Fair waring to mobile users, big image are can be up to about 5MB each.</p>
</header>
@@ -26,20 +27,20 @@
<h2>Core</h2>
<ul>
<li>
- <a href="https://images.unsplash.com/photo-1452963510533-a6368b834bf8?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=02a0de155409ee591fea7040c8acedb3" data-imagelightbox="0">
- <img src="https://images.unsplash.com/photo-1452963510533-a6368b834bf8?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=8d7880cd80b6a9f1169d0680c7a3c20d" alt="Photo by Lucia Velez de Paz">
+ <a href="https://images.unsplash.com/photo-1452976218590-7b9de7005af9?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=a612e4609107caddc122f3b887a3132c" data-imagelightbox="0">
+ <img src="https://images.unsplash.com/photo-1452976218590-7b9de7005af9?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=41f73fb91506e58a3b288001178ac0b1" alt="Photo by Scott Webb">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452963409233-e624c6cd4c11?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=eaa1bfb15011d3ee8243c40ffb6a873d" data-imagelightbox="0">
- <img src="https://images.unsplash.com/photo-1452963409233-e624c6cd4c11?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=a39955db5ea08eac8891df7a33be5f39" alt="Photo by Kate Zaidova">
+ <a href="https://images.unsplash.com/photo-1452975674591-23278034af1f?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=7d9b5e879892afd2e0d4d6c8081bbc7f" data-imagelightbox="0">
+ <img src="https://images.unsplash.com/photo-1452975674591-23278034af1f?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=131b124025b78e4dd4dfb1faa7b26f64" alt="Photo by Paul Green">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452962654861-dc5c7e89a3aa?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=2f8a1740919fed67fa3e92a5924a3dea" data-imagelightbox="0">
- <img src="https://images.unsplash.com/photo-1452962654861-dc5c7e89a3aa?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=38dd54d73602c09921e2a4dffdfc48d8" alt="Photo by Vladimir Kudinov">
+ <a href="https://images.unsplash.com/photo-1452975261254-982078333ab5?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=8fbe505068d6265cb87096611674f9e1" data-imagelightbox="0">
+ <img src="https://images.unsplash.com/photo-1452975261254-982078333ab5?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=8148bde06b7d7a1f13d07beb8339f0f6" alt="Photo by Paul Green">
</a>
</li>
</ul>
@@ -48,20 +49,20 @@
<h2>With activity indication</h2>
<ul>
<li>
- <a href="https://images.unsplash.com/photo-1452960962994-acf4fd70b632?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=e2bf2701a295324cd0c50b924fe208a6" data-imagelightbox="1">
- <img src="https://images.unsplash.com/photo-1452960962994-acf4fd70b632?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=aa2a0c19b8dd309357b4b27d03037825" alt="Photo by davide ragusa">
+ <a href="https://images.unsplash.com/photo-1452968011964-24f8831c43c3?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=b09459cef28f47eed3601df2a6ca92ed" data-imagelightbox="1">
+ <img src="https://images.unsplash.com/photo-1452968011964-24f8831c43c3?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=f8f1b709a845b3d20f8338a659701303" alt="Photo by Mantra Media">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452957731583-658917836266?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=bf0789c8876a9ad3342cba4c38ac6963" data-imagelightbox="1">
- <img src="https://images.unsplash.com/photo-1452957731583-658917836266?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=0bc4f8220d93fde1e8799b8832d1102a" alt="Photo by Camilla Bundgaard">
+ <a href="https://images.unsplash.com/photo-1452967712862-0cca1839ff27?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=9c2153686f713f2a4810d102e29919de" data-imagelightbox="1">
+ <img src="https://images.unsplash.com/photo-1452967712862-0cca1839ff27?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=23bd60490ce1dd4b477a387cf42940ee" alt="Photo by Mantra Media">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452957689853-fd2b4f3d3aa2?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=2ffc1e7221beba3ba73e48a15e78ef7f" data-imagelightbox="1">
- <img src="https://images.unsplash.com/photo-1452957689853-fd2b4f3d3aa2?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=3407b7de6a14bc903d596940985acb26" alt="Photo by Camilla Bundgaard">
+ <a href="https://images.unsplash.com/photo-1452964668643-b8f0a1601be4?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=0fbd8861578feabfcb21e87ab48be98c" data-imagelightbox="1">
+ <img src="https://images.unsplash.com/photo-1452964668643-b8f0a1601be4?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=e34b5a2bbb7d1282d6dc05e89d3c91d0" alt="Photo by Michael Duliba">
</a>
</li>
</ul>
@@ -70,20 +71,20 @@
<h2>With overlay & activity indication</h2>
<ul>
<li>
- <a href="https://images.unsplash.com/photo-1452955767226-455c94ad1bf2?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=987ec039e5bde5c23a29f83534c5a624" data-imagelightbox="2">
- <img src="https://images.unsplash.com/photo-1452955767226-455c94ad1bf2?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=fdd2f37c0bf66df35763fd971b0e8c2d" alt="Photo by Georgi Petrov">
+ <a href="https://images.unsplash.com/photo-1452963510533-a6368b834bf8?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=02a0de155409ee591fea7040c8acedb3" data-imagelightbox="2">
+ <img src="https://images.unsplash.com/photo-1452963510533-a6368b834bf8?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=8d7880cd80b6a9f1169d0680c7a3c20d" alt="Photo by Lucia Velez de Paz">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452953523127-a0949218fc33?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=0024f2c2152c99931b896f97a4895e58" data-imagelightbox="2">
- <img src="https://images.unsplash.com/photo-1452953523127-a0949218fc33?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=3aec9b2ff90657182333a50800c5111b" alt="Photo by Harshal Hirve">
+ <a href="https://images.unsplash.com/photo-1452963409233-e624c6cd4c11?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=eaa1bfb15011d3ee8243c40ffb6a873d" data-imagelightbox="2">
+ <img src="https://images.unsplash.com/photo-1452963409233-e624c6cd4c11?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=a39955db5ea08eac8891df7a33be5f39" alt="Photo by Kate Zaidova">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452953008873-ae5837174535?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=164f5bdd08fb25efe4e91973e8f392df" data-imagelightbox="2">
- <img src="https://images.unsplash.com/photo-1452953008873-ae5837174535?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=11ecbf2ad3e60ff796998f2ffcfe4942" alt="Photo by Alex Wing">
+ <a href="https://images.unsplash.com/photo-1452962654861-dc5c7e89a3aa?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=2f8a1740919fed67fa3e92a5924a3dea" data-imagelightbox="2">
+ <img src="https://images.unsplash.com/photo-1452962654861-dc5c7e89a3aa?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=38dd54d73602c09921e2a4dffdfc48d8" alt="Photo by Vladimir Kudinov">
</a>
</li>
</ul>
@@ -92,20 +93,20 @@
<h2>With "close" button & activity indication</h2>
<ul>
<li>
- <a href="https://images.unsplash.com/photo-1452952797148-d161124db4c8?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=1e4db22040a9df9756ed8eae82ec9213" data-imagelightbox="3">
- <img src="https://images.unsplash.com/photo-1452952797148-d161124db4c8?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=4914671db2468a15d6eabbae5da14316" alt="Photo by Andreas Kahlhöfer">
+ <a href="https://images.unsplash.com/photo-1452960962994-acf4fd70b632?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=e2bf2701a295324cd0c50b924fe208a6" data-imagelightbox="3">
+ <img src="https://images.unsplash.com/photo-1452960962994-acf4fd70b632?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=aa2a0c19b8dd309357b4b27d03037825" alt="Photo by davide ragusa">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452948491233-ad8a1ed01085?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=e9d56706132524d1c080ba95b50f66ed" data-imagelightbox="3">
- <img src="https://images.unsplash.com/photo-1452948491233-ad8a1ed01085?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=d7d2fdeeb16f4504d87e971e6a206b08" alt="Photo by Sven Scheuermeier">
+ <a href="https://images.unsplash.com/photo-1452957731583-658917836266?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=bf0789c8876a9ad3342cba4c38ac6963" data-imagelightbox="3">
+ <img src="https://images.unsplash.com/photo-1452957731583-658917836266?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=0bc4f8220d93fde1e8799b8832d1102a" alt="Photo by Camilla Bundgaard">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452947637175-7dc3f84f3350?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=b6986ce7c9660bb45280b0c4205fc7f1" data-imagelightbox="3">
- <img src="https://images.unsplash.com/photo-1452947637175-7dc3f84f3350?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=32bfef29b8549e2d30492fd1aaa5be51" alt="Photo by Sven Scheuermeier">
+ <a href="https://images.unsplash.com/photo-1452957689853-fd2b4f3d3aa2?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=2ffc1e7221beba3ba73e48a15e78ef7f" data-imagelightbox="3">
+ <img src="https://images.unsplash.com/photo-1452957689853-fd2b4f3d3aa2?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=3407b7de6a14bc903d596940985acb26" alt="Photo by Camilla Bundgaard">
</a>
</li>
</ul>
@@ -114,20 +115,20 @@
<h2>With caption & activity indication</h2>
<ul>
<li>
- <a href="https://images.unsplash.com/photo-1452942000102-9c4c7aaeac81?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=8c0269da7206a0dcc83a840a3fc7c57a" data-imagelightbox="4">
- <img src="https://images.unsplash.com/photo-1452942000102-9c4c7aaeac81?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=b9bc7dec4ff29dbfde154d74148eb94c" alt="Photo by Miriam Miles">
+ <a href="https://images.unsplash.com/photo-1452955767226-455c94ad1bf2?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=987ec039e5bde5c23a29f83534c5a624" data-imagelightbox="4">
+ <img src="https://images.unsplash.com/photo-1452955767226-455c94ad1bf2?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=fdd2f37c0bf66df35763fd971b0e8c2d" alt="Photo by Georgi Petrov">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452933006409-19b87dc327b7?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=703b8f947dc61bebde4e1fdb5e008eeb" data-imagelightbox="4">
- <img src="https://images.unsplash.com/photo-1452933006409-19b87dc327b7?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=74354b0faacb8cf70d2655b9fadf5846" alt="Photo by Timon Studler">
+ <a href="https://images.unsplash.com/photo-1452953523127-a0949218fc33?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=0024f2c2152c99931b896f97a4895e58" data-imagelightbox="4">
+ <img src="https://images.unsplash.com/photo-1452953523127-a0949218fc33?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=3aec9b2ff90657182333a50800c5111b" alt="Photo by Harshal Hirve">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452924872281-04696e001ea3?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=17fbca60da821287959eacae0ab6144b" data-imagelightbox="4">
- <img src="https://images.unsplash.com/photo-1452924872281-04696e001ea3?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=5905984278271e96ec6e2d0ac7710109" alt="Photo by Justin Cron">
+ <a href="https://images.unsplash.com/photo-1452953008873-ae5837174535?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=164f5bdd08fb25efe4e91973e8f392df" data-imagelightbox="4">
+ <img src="https://images.unsplash.com/photo-1452953008873-ae5837174535?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=11ecbf2ad3e60ff796998f2ffcfe4942" alt="Photo by Alex Wing">
</a>
</li>
</ul>
@@ -136,20 +137,20 @@
<h2>With navigation & activity indication</h2>
<ul>
<li>
- <a href="https://images.unsplash.com/photo-1452924447697-482a22f55f42?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=262ee0b03a7c11fca9765f804fd71f82" data-imagelightbox="5">
- <img src="https://images.unsplash.com/photo-1452924447697-482a22f55f42?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=c87406375635ef275c0d437a279296b4" alt="Photo by Madeline Gibbs">
+ <a href="https://images.unsplash.com/photo-1452952797148-d161124db4c8?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=1e4db22040a9df9756ed8eae82ec9213" data-imagelightbox="5">
+ <img src="https://images.unsplash.com/photo-1452952797148-d161124db4c8?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=4914671db2468a15d6eabbae5da14316" alt="Photo by Andreas Kahlhöfer">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452915858640-325b467fe554?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=0044ed81a2d247724c452ba939980a6d" data-imagelightbox="5">
- <img src="https://images.unsplash.com/photo-1452915858640-325b467fe554?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=02ed27e7bb8e15fb1df067ee7beb89dc" alt="Photo by Nathan Shively">
+ <a href="https://images.unsplash.com/photo-1452948491233-ad8a1ed01085?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=e9d56706132524d1c080ba95b50f66ed" data-imagelightbox="5">
+ <img src="https://images.unsplash.com/photo-1452948491233-ad8a1ed01085?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=d7d2fdeeb16f4504d87e971e6a206b08" alt="Photo by Sven Scheuermeier">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452915285804-941a8c0cd8af?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=251ef836ada7088607cb82c4f51a674d" data-imagelightbox="5">
- <img src="https://images.unsplash.com/photo-1452915285804-941a8c0cd8af?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=7886267096c4f963c7e58efdb50fe9fc" alt="Photo by Callum Gale">
+ <a href="https://images.unsplash.com/photo-1452947637175-7dc3f84f3350?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=b6986ce7c9660bb45280b0c4205fc7f1" data-imagelightbox="5">
+ <img src="https://images.unsplash.com/photo-1452947637175-7dc3f84f3350?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=32bfef29b8549e2d30492fd1aaa5be51" alt="Photo by Sven Scheuermeier">
</a>
</li>
</ul>
@@ -158,20 +159,20 @@
<h2>Combination</h2>
<ul>
<li>
- <a href="https://images.unsplash.com/photo-1452914793772-af331bf6e4b6?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=c2e9ecd41653d863b79cecb82afccacf" data-imagelightbox="6">
- <img src="https://images.unsplash.com/photo-1452914793772-af331bf6e4b6?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=54a8d7b094f32816d42dd6ab9b410be4" alt="Photo by Sang Huynh">
+ <a href="https://images.unsplash.com/photo-1452942168079-6ec82039465d?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=e481ae0a2f95c79268ad81d164fd84ae" data-imagelightbox="6">
+ <img src="https://images.unsplash.com/photo-1452942168079-6ec82039465d?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=2bd7dd32e6d7ad2a360ae7a7eeb5f4eb" alt="Photo by Susana Fernández">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452909809578-94f609b1facc?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=df0633cfc264005f30d4b54a7b4a463e" data-imagelightbox="6">
- <img src="https://images.unsplash.com/photo-1452909809578-94f609b1facc?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=bef3ff82adca61b4477f84ea16f4c61d" alt="Photo by Vladimir Kudinov">
+ <a href="https://images.unsplash.com/photo-1452942000102-9c4c7aaeac81?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=8c0269da7206a0dcc83a840a3fc7c57a" data-imagelightbox="6">
+ <img src="https://images.unsplash.com/photo-1452942000102-9c4c7aaeac81?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=b9bc7dec4ff29dbfde154d74148eb94c" alt="Photo by Miriam Miles">
</a>
</li>
<li>
- <a href="https://images.unsplash.com/photo-1452902793598-4a506dd9a38e?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=a4e8de5703122be9dfc2e9a1eba64f1e" data-imagelightbox="6">
- <img src="https://images.unsplash.com/photo-1452902793598-4a506dd9a38e?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=a813370d501160abb1c9b63ba953baa8" alt="Photo by David Boozer">
+ <a href="https://images.unsplash.com/photo-1452933006409-19b87dc327b7?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=703b8f947dc61bebde4e1fdb5e008eeb" data-imagelightbox="6">
+ <img src="https://images.unsplash.com/photo-1452933006409-19b87dc327b7?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=200&fit=max&s=74354b0faacb8cf70d2655b9fadf5846" alt="Photo by Timon Studler">
</a>
</li>
</ul>
diff --git a/touch-imagelightbox.js b/touch-imagelightbox.js
deleted file mode 100644
index 1117518..0000000
--- a/touch-imagelightbox.js
+++ /dev/null
@@ -1,1214 +0,0 @@
-var LightBox =
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
-
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
-
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
-
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-
-
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
-
- __webpack_require__(1);
- __webpack_require__(8);
- __webpack_require__(9);
- module.exports = __webpack_require__(10);
-
-
-/***/ },
-/* 1 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
- * Created by Victor Häggqvist on 1/12/16.
- */
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.LightBox = undefined;
-
- var _CSSUtil = __webpack_require__(2);
-
- var _animate = __webpack_require__(3);
-
- var _LightDirection = __webpack_require__(4);
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- var log = __webpack_require__(5);
-
- log.setDefaultLevel(log.levels.DEBUG);
-
- var LightBox = exports.LightBox = function () {
- function LightBox(targetSelector) {
- var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
-
- _classCallCheck(this, LightBox);
-
- log.info('LightBox');
- this.targets = document.querySelectorAll(targetSelector);
- log.debug(this.targets);
-
- log.debug('HAS_TOUCH ' + LightBox.HAS_TOUCH);
- var defaultOptions = {
- allowedTypes: 'png|jpg|jpeg|gif',
- selectorId: 'imagelightbox',
- animationSpeed: 350,
- preloadNext: true,
- enableKeyboard: true,
- quitOnEnd: false,
- quitOnImgClick: false,
- quitOnDocClick: true,
- //onStart: false,
- //onEnd: false,
- //onLoadStart: false,
- //onLoadEnd: false,
- requestFullscreenOnMobile: true
- };
-
- this.options = Object.assign(options, defaultOptions);
- log.info(this.options);
-
- this.target = null;
- this.image = null;
- this.imageWidth = 0;
- this.imageHeight = 0;
- this.swipeDiff = 0;
- this.inProgress = false;
-
- this.swipeStart = 0;
- this.swipeEnd = 0;
- this.imagePosLeft = 0;
-
- this.onStartListeners = [];
- this.onEndListeners = [];
- this.onLoadStartListeners = [];
- this.onLoadEndListeners = [];
-
- this.bindEvents();
- }
-
- _createClass(LightBox, [{
- key: 'bindEvents',
- value: function bindEvents() {
- var _this = this;
-
- Array.prototype.forEach.call(this.targets, function (ele) {
- ele.addEventListener('click', _this.onImageClick.bind(_this));
- });
- window.addEventListener('resize', this.windowResizeListener.bind(this));
-
- if (this.options.quitOnDocClick) {
- document.body.addEventListener(LightBox.HAS_TOUCH ? 'touchend' : 'click', this.documentClick.bind(this));
- }
-
- if (this.options.enableKeyboard) {
- document.body.addEventListener('keyup', this.handleKeyboard.bind(this));
- }
-
- //document.querySelector('#'+this.options.selectorId).addEventListener('click', this.floatingImageClick.bind(this));
- }
- }, {
- key: 'handleKeyboard',
- value: function handleKeyboard(e) {
- if (this.image === null) return true;
-
- e.preventDefault();
-
- if (e.keyCode === 27) this.quitLightbox();
-
- if (e.keyCode === 37 || e.keyCode === 39) {
- var gotoIndex = Array.prototype.indexOf.call(this.targets, this.target) - (e.keyCode === 37 ? 1 : -1);
-
- if (gotoIndex > this.targets.length - 1) {
- this.target = this.targets[0];
- } else if (gotoIndex < 0) {
- this.target = this.targets[this.targets.length - 1];
- } else {
- this.target = this.targets[gotoIndex];
- }
-
- this.loadImage(e.keyCode === 37 ? _LightDirection.LightDirection.LEFT : _LightDirection.LightDirection.RIGHT);
- }
- }
- }, {
- key: 'documentClick',
- value: function documentClick() {
- log.debug('document click');
-
- if (this.image !== null && this.target.href === this.image.src) {
- log.info('quitting');
- this.quitLightbox();
- }
- }
- }, {
- key: 'quitLightbox',
- value: function quitLightbox() {
- var _this2 = this;
-
- log.debug('quitLightbox');
- if (this.image === null) return false;
-
- _CSSUtil.CSSUtil.setTransitionProperty(this.image, 'opacity ' + this.options.animationSpeed / 1000 + 's linear');
- setTimeout(function () {
- // without timeout it's to fast to make it fade and just jumps to 1 instant
- _this2.image.style.opacity = 0;
- }, 5);
-
- setTimeout(function () {
- _this2.removeImage();
- _this2.inProgress = false;
- if (_this2.options.onEnd !== false) _this2.options.onEnd();
- }, this.options.animationSpeed);
- }
- }, {
- key: 'onImageClick',
- value: function onImageClick(event) {
- console.log(event);
- var element = event.srcElement.parentElement;
- //console.log(this.isTargetValid(nav));
- if (!this.isTargetValid(element)) return true;
-
- event.preventDefault();
-
- //if (LightBox.HAS_TOUCH) {
- // log.debug('requesting fullscreen');
- // document.body.webkitRequestFullscreen()
- //}
-
- if (this.inProgress) return;
-
- this.inProgress = false;
-
- this.onStartListener.forEach(function (l) {
- return l();
- });
-
- this.target = element;
-
- this.loadImage();
- }
- }, {
- key: 'isTargetValid',
- value: function isTargetValid(element) {
- var validTypes = new RegExp("(\.(" + this.options.allowedTypes + ")$)");
-
- return element.tagName.toLowerCase() === 'a' && validTypes.test(element.href);
- }
- }, {
- key: 'loadImage',
- value: function loadImage() {
- var _this3 = this;
-
- var direction = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
-
- log.info('loadImage');
- if (this.inProgress) return false;
- log.debug('not progress');
-
- if (this.image !== null) {
- log.debug('has current image');
- if (direction !== false && (this.targets.length < 2 || this.options.quitOnEnd === true && (direction === _LightDirection.LightDirection.RIGHT && Array.prototype.indexOf(this.targets, this.target) === 0 || direction === _LightDirection.LightDirection.LEFT && Array.prototype.indexOf(this.targets, this.target) === targets.length - 1))) {
- //quitLightbox();
- return false;
- }
-
- log.debug('unload');
-
- _CSSUtil.CSSUtil.setTransitionProperty(this.image, 'opacity ' + this.options.animationSpeed / 1000 + 's linear');
- var transitionArgs = 100 * direction - this.swipeDiff + 'px';
- this.image.style.transform = 'translateX(' + transitionArgs + ')';
-
- setTimeout(function () {
- // without timeout it's to fast to make it fade and just jumps to 1 instant
- _this3.image.style.opacity = 0;
- }, 5);
-
- setTimeout(function () {
- log.debug('remove from dom');
- _this3.removeImage();
- }, this.options.animationSpeed);
-
- this.swipeDiff = 0;
- }
-
- this.inProgress = true;
- this.onLoadStartListeners.forEach(function (l) {
- return l();
- });
-
- setTimeout(function () {
- log.debug('loadImage in');
- var image = new Image();
- _this3.image = image;
- image.onload = function () {
- image.id = _this3.options.selectorId;
- log.debug('img loaded');
- document.body.appendChild(image);
- _this3.setImage();
-
- image.style.opacity = 0;
-
- var interpretedSpeed = _this3.options.animationSpeed / 1000;
- log.debug(interpretedSpeed);
- _CSSUtil.CSSUtil.setTransitionProperty(image, 'opacity ' + interpretedSpeed + 's ease');
- image.style.transform = 'translateX(0px)';
-
- setTimeout(function () {
- // without timeout it's to fast to make it fade and just jumps to 1 instant
- image.style.opacity = 1;
- }, 10);
-
- setTimeout(function () {
- _this3.inProgress = false;
- _this3.onLoadEndListeners.forEach(function (l) {
- return l();
- });
- }, _this3.options.animationSpeed);
-
- if (_this3.options.preloadNext) {
- var index = Array.prototype.indexOf.call(_this3.targets, _this3.target);
- var next = _this3.targets[index + 1];
-
- if (next !== null) {
- log.debug('preloading next');
- var nextImg = new Image();
- nextImg.src = next.href;
- } else {
- log.debug('no preloading');
- }
- }
- };
- image.src = _this3.target.href;
-
- _this3.swipeStart = 0;
- _this3.swipeEnd = 0;
- //this.imagePosLeft = 0;
-
- if (LightBox.HAS_POINTERS) {
- image.addEventListener('pointerup', _this3.imageClickEvent.bind(_this3));
- image.addEventListener('MSPointerUp', _this3.imageClickEvent.bind(_this3));
- } else {
- image.addEventListener('click', _this3.imageClickEvent.bind(_this3));
- }
-
- ['touchstart', 'pointerdown', 'MSPointerDown'].forEach(function (name) {
- image.addEventListener(name, _this3.imageTouchStart.bind(_this3));
- });
-
- ['touchmove', 'pointermove', 'MSPointerMove'].forEach(function (name) {
- image.addEventListener(name, _this3.imageTouchMove.bind(_this3));
- });
-
- ['touchend', 'touchcancel', 'pointerup', 'MSPointerUp'].forEach(function (name) {
- image.addEventListener(name, _this3.imageTouchEnd.bind(_this3));
- });
- }, this.options.animationSpeed + 100);
- }
- }, {
- key: 'removeImage',
- value: function removeImage() {
- document.body.removeChild(this.image);
- this.image = null;
- }
- }, {
- key: 'imageClickEvent',
- value: function imageClickEvent(e) {
- e.preventDefault();
- log.debug('click');
-
- if (this.options.quitOnImgClick) {
- L.i('implement this');
- //quitLightbox();
- return false;
- }
-
- if (this.wasTouched(e)) return true;
-
- var posX = e.pageX - e.target.offsetLeft;
- log.debug(posX);
-
- var gotoIndex = Array.prototype.indexOf.call(this.targets, this.target) - (this.imageWidth / 2 > posX ? 1 : -1);
-
- if (gotoIndex > this.targets.length - 1) {
- this.target = this.targets[0];
- } else if (gotoIndex < 0) {
- this.target = this.targets[this.targets.length - 1];
- } else {
- this.target = this.targets[gotoIndex];
- }
-
- this.loadImage(this.imageWidth / 2 > posX ? _LightDirection.LightDirection.LEFT : _LightDirection.LightDirection.RIGHT);
- }
- }, {
- key: 'imageTouchStart',
- value: function imageTouchStart(e) {
- if (!this.wasTouched(e) || this.options.quitOnImgClick) return true;
-
- this.swipeStart = e.pageX || e.touches[0].pageX;
- }
- }, {
- key: 'imageTouchMove',
- value: function imageTouchMove(e) {
- if (!this.wasTouched(e) || this.options.quitOnImgClick) return true;
-
- e.preventDefault();
- this.swipeEnd = e.pageX || e.touches[0].pageX;
- this.swipeDiff = this.swipeStart - this.swipeEnd;
-
- this.image.style.transform = 'translateX(' + -this.swipeDiff + 'px)';
- //CSSUtil.setTransitionProperty(this.image, 'transform 0s linear');
- }
- }, {
- key: 'imageTouchEnd',
- value: function imageTouchEnd(e) {
- if (!this.wasTouched(e) || this.options.quitOnImgClick) return true;
-
- log.debug(this.swipeDiff);
- if (Math.abs(this.swipeDiff) > 50) {
- var gotoIndex = Array.prototype.indexOf.call(this.targets, this.target) - (this.swipeDiff < 0 ? 1 : -1);
-
- if (gotoIndex > this.targets.length - 1) {
- this.target = this.targets[0];
- } else if (gotoIndex < 0) {
- this.target = this.targets[this.targets.length - 1];
- } else {
- this.target = this.targets[gotoIndex];
- }
-
- var direction = this.swipeDiff > 0 ? _LightDirection.LightDirection.RIGHT : _LightDirection.LightDirection.LEFT;
- this.loadImage(direction);
- } else {
- this.image.style.transform = 'translateX(0px)';
- //CSSUtil.setTransitionProperty(this.image, 'transform '+ options.animationSpeed / 1000 +'s linear');
- }
- }
- }, {
- key: 'setImage',
- value: function setImage() {
- var _this4 = this;
-
- if (!this.image) return false;
-
- var screenWidth = window.innerWidth * 0.8;
- var screenHeight = window.innerHeight * 0.9;
-
- var tmpImage = new Image();
- tmpImage.src = this.image.src;
- tmpImage.onload = function () {
- _this4.imageWidth = tmpImage.width;
- _this4.imageHeight = tmpImage.height;
-
- if (_this4.imageWidth > screenWidth || _this4.imageHeight > screenHeight) {
- var ratio = _this4.imageWidth / _this4.imageHeight > screenWidth / screenHeight ? _this4.imageWidth / screenWidth : _this4.imageHeight / screenHeight;
- _this4.imageWidth /= ratio;
- _this4.imageHeight /= ratio;
- }
-
- _this4.image.style.width = _this4.imageWidth + 'px';
- _this4.image.style.height = _this4.imageHeight + 'px';
- _this4.image.style.top = (window.innerHeight - _this4.imageHeight) / 2 + 'px';
- _this4.image.style.left = (window.innerWidth - _this4.imageWidth) / 2 + 'px';
- };
- }
- }, {
- key: 'wasTouched',
- value: function wasTouched(event) {
- if (LightBox.HAS_TOUCH) return true;
-
- if (!LightBox.HAS_POINTERS || typeof event === 'undefined' || typeof event.pointerType === 'undefined') return false;
-
- if (typeof event.MSPOINTER_TYPE_MOUSE !== 'undefined') {
- if (event.MSPOINTER_TYPE_MOUSE !== event.pointerType) return true;
- } else {
- if (event.pointerType !== 'mouse') return true;
- }
-
- return false;
- }
- }, {
- key: 'windowResizeListener',
- value: function windowResizeListener() {
- log.debug('resized');
- this.setImage();
- }
- }, {
- key: 'addOnStartListener',
- value: function addOnStartListener(listener) {
- this.onStartListeners.push(listener);
- }
- }, {
- key: 'addOnEndListener',
- value: function addOnEndListener(listener) {
- this.onEndListeners.push(listener);
- }
- }, {
- key: 'addOnLoadStartListener',
- value: function addOnLoadStartListener(listener) {
- this.onLoadStartListeners.push(listener);
- }
- }, {
- key: 'addOnLoadEndListener',
- value: function addOnLoadEndListener(listener) {
- this.onLoadEndListeners.push(listener);
- }
- }, {
- key: 'registerPlugin',
- value: function registerPlugin(plugin) {
- plugin.register(this);
- }
- }]);
-
- return LightBox;
- }();
-
- LightBox.HAS_TOUCH = 'ontouchstart' in window;
- LightBox.HAS_POINTERS = window.navigator.pointerEnabled || window.navigator.msPointerEnabled;
-
-/***/ },
-/* 2 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- /**
- * Created by Victor Häggqvist on 1/12/16.
- */
-
- var CSSUtil = exports.CSSUtil = function () {
- function CSSUtil() {
- _classCallCheck(this, CSSUtil);
- }
-
- _createClass(CSSUtil, null, [{
- key: 'setTransitionProperty',
-
- /**
- * transion need to be set on property
- *
- * using key-value dont work
- *
- * @param ele DOMElement
- * @param value
- */
- value: function setTransitionProperty(ele, value) {
- var style = ele.style;
- if (style.transition === '') {
- style.transition = value;
- return;
- }
- if (style.WebkitTransition === '') {
- style.WebkitTransition = value;
- return;
- }
- if (style.MozTransition === '') {
- style.MozTransition = value;
- return;
- }
- if (style.OTransition === '') {
- style.OTransition = value;
- }
- }
- }, {
- key: 'cssTransitionSupport',
- value: function cssTransitionSupport() {
- var d = document.body || document.documentElement,
- s = d.style;
- if (s.WebkitTransition === '') return '-webkit-';
- if (s.MozTransition === '') return '-moz-';
- if (s.OTransition === '') return '-o-';
- if (s.transition === '') return '';
- return false;
- }
- }, {
- key: 'cssTransitionTranslateX',
- value: function cssTransitionTranslateX(element, positionX, speed) {
- var options = {};
- var prefix = CSSUtil.cssTransitionSupport();
- element.style[prefix + 'transform'] = 'translateX(' + positionX + ')';
- element.style[prefix + 'transition'] = prefix + 'transform ' + speed + 's linear';
- //nav.style = Object.assign(options, nav.style);
- }
- }]);
-
- return CSSUtil;
- }();
-
- CSSUtil.isCssTransitionSupport = CSSUtil.cssTransitionSupport() !== false;
-
-/***/ },
-/* 3 */
-/***/ function(module, exports) {
-
- "use strict";
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
- var animate = exports.animate = function () {
-
- "use strict";
-
- var defaults = {
- delay: 0,
- duration: 400,
- easing: "ease"
- };
-
- // array utils ===================================================================================
-
- var head = function head(arr) {
- return arr[0];
- };
-
- var tail = function tail(arr) {
- return arr.slice(1);
- };
-
- var contains = function () {
- return Array.prototype.includes ? function (arr, value) {
- return arr.includes(value);
- } : function (arr, value) {
- return arr.some(function (el) {
- return el === value;
- });
- };
- }();
-
- var toArray = function toArray(obj) {
- if (obj.nodeType) {
- return [obj];
- }
- if (Array.isArray(obj)) {
- return obj;
- }
- return [].concat(_toConsumableArray(obj));
- };
-
- // params utils ==================================================================================
-
- var requireParams = function requireParams(func) {
- return function (params) {
- if ((typeof params === "undefined" ? "undefined" : _typeof(params)) != "object") return;
- func(params);
- };
- };
-
- var getParamsEl = function getParamsEl(el) {
- return toArray(typeof el == "string" ? selectElements(el) : el);
- };
-
- // misc utils ====================================================================================
-
- var selectElements = function selectElements(selector) {
- var context = arguments.length <= 1 || arguments[1] === undefined ? document : arguments[1];
-
- if (/^[\#.]?[\w-]+$/.test(selector)) {
- if (head(selector) == ".") {
- return context.getElementsByClassName(tail(selector));
- }
- if (head(selector) == "#") {
- return context.getElementById(tail(selector));
- }
- return context.getElementsByTagName(selector);
- }
- return context.querySelectorAll(selector);
- };
-
- var hasUnit = function hasUnit(value) {
- return (/\D$/.test(value)
- );
- };
-
- // transition ====================================================================================
-
- var setTransition = function () {
- var addUnit = function addUnit(value) {
- if (hasUnit(value)) {
- return value;
- }
- return value + "ms";
- };
- return function (el, params) {
- var transition = {
- "property": "opacity," + transformProperty(),
- "duration": addUnit(params.duration || defaults.duration),
- "timing-function": params.easing || defaults.easing,
- "delay": addUnit(params.delay || defaults.delay)
- };
- Object.keys(transition).forEach(function (prop) {
- el.style["transition-" + prop] = transition[prop];
- });
- };
- }();
-
- var clearTransition = function clearTransition(params) {
- var clearListener = function clearListener(event) {
- event.target.removeEventListener("transitionend", clearListener);
- if (!params.complete) return;
- params.complete.call(event.target);
- };
- return clearListener;
- };
-
- // opacity =======================================================================================
-
- var setOpacity = function setOpacity(el, params) {
- if (params.opacity == undefined) return;
- el.style.opacity = params.opacity;
- };
-
- // transform =====================================================================================
-
- var transformProperty = function () {
- var transform;
- return function () {
- if (!transform) {
- transform = "transform" in document.body.style ? "transform" : "-webkit-transform";
- }
- return transform;
- };
- }();
-
- var isTransform = function () {
- var ignore = ["complete", "el", "opacity"].concat(Object.keys(defaults));
- return function (key) {
- return !contains(ignore, key);
- };
- }();
-
- var getTransformFunctions = function getTransformFunctions(params) {
- return Object.keys(params).filter(function (key) {
- return isTransform(key);
- });
- };
-
- var setTransform = function () {
- var addUnit = function addUnit(transformFunction, value) {
- if (hasUnit(value) || /scale/.test(transformFunction)) {
- return value;
- }
- if (/rotate|skew/.test(transformFunction)) {
- return value + "deg";
- }
- return value + "px";
- };
- return function (el, params) {
- var transforms = getTransformFunctions(params);
- if (!transforms.length) return;
- el.style[transformProperty()] = transforms.map(function (func) {
- return func + "(" + addUnit(func, params[func]) + ")";
- }).join(" ");
- };
- }();
-
- // init ==========================================================================================
-
- var setStyle = function setStyle(params) {
- return function (el) {
- // wait for the next frame
- requestAnimationFrame(function () {
- [setTransition, setOpacity, setTransform].forEach(function (func) {
- func(el, params);
- });
- });
- el.addEventListener("transitionend", clearTransition(params));
- };
- };
-
- return requireParams(function (params) {
- getParamsEl(params.el).forEach(setStyle(params));
- });
- }();
-
-/***/ },
-/* 4 */
-/***/ function(module, exports) {
-
- "use strict";
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- /**
- * Created by Victor Häggqvist on 1/14/16.
- */
-
- var LightDirection = exports.LightDirection = function LightDirection() {
- _classCallCheck(this, LightDirection);
- };
-
- LightDirection.LEFT = 1;
- LightDirection.RIGHT = -1;
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) {
-
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module) {'use strict';
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
- /*
- * loglevel - https://github.com/pimterry/loglevel
- *
- * Copyright (c) 2013 Tim Perry
- * Licensed under the MIT license.
- */
- (function (root, definition) {
- "use strict";
-
- if (( false ? 'undefined' : _typeof(module)) === 'object' && module.exports && "function" === 'function') {
- module.exports = definition();
- } else if ("function" === 'function' && _typeof(__webpack_require__(7)) === 'object') {
- !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {
- root.log = definition();
- }
- })(undefined, function () {
- "use strict";
-
- var noop = function noop() {};
- var undefinedType = "undefined";
-
- function realMethod(methodName) {
- if ((typeof console === 'undefined' ? 'undefined' : _typeof(console)) === undefinedType) {
- return false; // We can't build a real method without a console to log to
- } else if (console[methodName] !== undefined) {
- return bindMethod(console, methodName);
- } else if (console.log !== undefined) {
- return bindMethod(console, 'log');
- } else {
- return noop;
- }
- }
-
- function bindMethod(obj, methodName) {
- var method = obj[methodName];
- if (typeof method.bind === 'function') {
- return method.bind(obj);
- } else {
- try {
- return Function.prototype.bind.call(method, obj);
- } catch (e) {
- // Missing bind shim or IE8 + Modernizr, fallback to wrapping
- return function () {
- return Function.prototype.apply.apply(method, [obj, arguments]);
- };
- }
- }
- }
-
- // these private functions always need `this` to be set properly
-
- function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
- return function () {
- if ((typeof console === 'undefined' ? 'undefined' : _typeof(console)) !== undefinedType) {
- replaceLoggingMethods.call(this, level, loggerName);
- this[methodName].apply(this, arguments);
- }
- };
- }
-
- function replaceLoggingMethods(level, loggerName) {
- /*jshint validthis:true */
- for (var i = 0; i < logMethods.length; i++) {
- var methodName = logMethods[i];
- this[methodName] = i < level ? noop : this.methodFactory(methodName, level, loggerName);
- }
- }
-
- function defaultMethodFactory(methodName, level, loggerName) {
- /*jshint validthis:true */
- return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
- }
-
- var logMethods = ["trace", "debug", "info", "warn", "error"];
-
- function Logger(name, defaultLevel, factory) {
- var self = this;
- var currentLevel;
- var storageKey = "loglevel";
- if (name) {
- storageKey += ":" + name;
- }
-
- function persistLevelIfPossible(levelNum) {
- var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
-
- // Use localStorage if available
- try {
- window.localStorage[storageKey] = levelName;
- return;
- } catch (ignore) {}
-
- // Use session cookie as fallback
- try {
- window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
- } catch (ignore) {}
- }
-
- function getPersistedLevel() {
- var storedLevel;
-
- try {
- storedLevel = window.localStorage[storageKey];
- } catch (ignore) {}
-
- if ((typeof storedLevel === 'undefined' ? 'undefined' : _typeof(storedLevel)) === undefinedType) {
- try {
- var cookie = window.document.cookie;
- var location = cookie.indexOf(encodeURIComponent(storageKey) + "=");
- if (location) {
- storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];
- }
- } catch (ignore) {}
- }
-
- // If the stored level is not valid, treat it as if nothing was stored.
- if (self.levels[storedLevel] === undefined) {
- storedLevel = undefined;
- }
-
- return storedLevel;
- }
-
- /*
- *
- * Public API
- *
- */
-
- self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3,
- "ERROR": 4, "SILENT": 5 };
-
- self.methodFactory = factory || defaultMethodFactory;
-
- self.getLevel = function () {
- return currentLevel;
- };
-
- self.setLevel = function (level, persist) {
- if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {
- level = self.levels[level.toUpperCase()];
- }
- if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
- currentLevel = level;
- if (persist !== false) {
- // defaults to true
- persistLevelIfPossible(level);
- }
- replaceLoggingMethods.call(self, level, name);
- if ((typeof console === 'undefined' ? 'undefined' : _typeof(console)) === undefinedType && level < self.levels.SILENT) {
- return "No console available for logging";
- }
- } else {
- throw "log.setLevel() called with invalid level: " + level;
- }
- };
-
- self.setDefaultLevel = function (level) {
- if (!getPersistedLevel()) {
- self.setLevel(level, false);
- }
- };
-
- self.enableAll = function (persist) {
- self.setLevel(self.levels.TRACE, persist);
- };
-
- self.disableAll = function (persist) {
- self.setLevel(self.levels.SILENT, persist);
- };
-
- // Initialize with the right level
- var initialLevel = getPersistedLevel();
- if (initialLevel == null) {
- initialLevel = defaultLevel == null ? "WARN" : defaultLevel;
- }
- self.setLevel(initialLevel, false);
- }
-
- /*
- *
- * Package-level API
- *
- */
-
- var defaultLogger = new Logger();
-
- var _loggersByName = {};
- defaultLogger.getLogger = function getLogger(name) {
- if (typeof name !== "string" || name === "") {
- throw new TypeError("You must supply a name when creating a logger.");
- }
-
- var logger = _loggersByName[name];
- if (!logger) {
- logger = _loggersByName[name] = new Logger(name, defaultLogger.getLevel(), defaultLogger.methodFactory);
- }
- return logger;
- };
-
- // Grab the current global log variable in case of overwrite
- var _log = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== undefinedType ? window.log : undefined;
- defaultLogger.noConflict = function () {
- if ((typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== undefinedType && window.log === defaultLogger) {
- window.log = _log;
- }
-
- return defaultLogger;
- };
-
- return defaultLogger;
- });
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6)(module)))
-
-/***/ },
-/* 6 */
-/***/ function(module, exports) {
-
- "use strict";
-
- module.exports = function (module) {
- if (!module.webpackPolyfill) {
- module.deprecate = function () {};
- module.paths = [];
- // module.parent = undefined by default
- module.children = [];
- module.webpackPolyfill = 1;
- }
- return module;
- };
-
-/***/ },
-/* 7 */
-/***/ function(module, exports) {
-
- /* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {module.exports = __webpack_amd_options__;
-
- /* WEBPACK VAR INJECTION */}.call(exports, {}))
-
-/***/ },
-/* 8 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- /**
- * Created by Victor Häggqvist on 1/14/16.
- */
-
- var ActivityIndicator = exports.ActivityIndicator = function () {
- function ActivityIndicator() {
- _classCallCheck(this, ActivityIndicator);
-
- this.nav = document.createElement('div');
- this.nav.id = 'imagelightbox-loading';
- this.nav.appendChild(document.createElement('div'));
- }
-
- /**
- *
- * @param {LightBox} lightbox
- */
-
- _createClass(ActivityIndicator, [{
- key: 'register',
- value: function register(lightbox) {
- lightbox.addOnLoadStartListener(this.activityIndicatorOn.bind(this));
- lightbox.addOnLoadEndListener(this.activityIndicatorOff.bind(this));
- lightbox.addOnEndListener(this.activityIndicatorOff.bind(this));
- }
- }, {
- key: 'activityIndicatorOn',
- value: function activityIndicatorOn() {
- document.body.appendChild(this.nav);
- //$('<div id="imagelightbox-loading"><div></div></div>' ).appendTo('body');
- }
- }, {
- key: 'activityIndicatorOff',
- value: function activityIndicatorOff() {
- document.body.removeChild(this.nav);
- //$('#imagelightbox-loading').remove();
- }
- }]);
-
- return ActivityIndicator;
- }();
-
-/***/ },
-/* 9 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- /**
- * Created by Victor Häggqvist on 1/14/16.
- */
-
- var CloseButton = exports.CloseButton = function () {
- function CloseButton() {
- _classCallCheck(this, CloseButton);
-
- this.nav = document.createElement('a');
- this.nav.id = 'imagelightbox-close';
- this.nav.innerHTML = 'Close';
- }
-
- _createClass(CloseButton, [{
- key: 'register',
- value: function register(lightbox) {
- this.lightbox = lightbox;
- lightbox.addOnStartListener(this.showButton.bind(this));
- lightbox.addOnEndListener(this.hideButton.bind(this));
- }
- }, {
- key: 'showButton',
- value: function showButton() {
- var _this = this;
-
- ['click', 'touchend'].forEach(function (name) {
- _this.nav.addEventListener(name, _this.exitLightbox.bind(_this));
- });
-
- document.body.appendChild(this.nav);
-
- //$('<a href="#" id="imagelightbox-close">Close</a>').appendTo('body')
- // .on('click touchend', function(){ $(this).remove(); instance.quitImageLightbox(); return false; });
- }
- }, {
- key: 'hideButton',
- value: function hideButton() {
- document.body.removeChild(this.nav);
- }
- }, {
- key: 'exitLightbox',
- value: function exitLightbox() {
- this.lightbox.quitImageLightbox();
- }
- }]);
-
- return CloseButton;
- }();
-
-/***/ },
-/* 10 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- /**
- * Created by Victor Häggqvist on 1/14/16.
- */
-
- var Overlay = exports.Overlay = function () {
- function Overlay() {
- _classCallCheck(this, Overlay);
-
- this.nav = document.createElement('div');
- this.nav.id = 'imagelightbox-overlay';
- }
-
- _createClass(Overlay, [{
- key: 'register',
- value: function register(lightbox) {
- lightbox.addOnStartListener(this.overlayOn.bind(this));
- lightbox.addOnEndListener(this.overlayOff.bind(this));
- }
- }, {
- key: 'overlayOn',
- value: function overlayOn() {
- document.body.appendChild(this.nav);
- }
- }, {
- key: 'overlayOff',
- value: function overlayOff() {
- document.body.removeChild(this.nav);
- }
- }]);
-
- return Overlay;
- }();
-
-/***/ }
-/******/ ]);