index.html 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Bootstrap Lightbox</title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
  7. <link href="../dist/ekko-lightbox.css" rel="stylesheet">
  8. <!-- for documentation only -->
  9. <style type="text/css">
  10. div.row > div > div.row {
  11. margin-bottom: 15px;
  12. }
  13. html {
  14. background-color: #02709e;
  15. }
  16. body {
  17. background: #fefefe;
  18. padding-bottom: 50px;
  19. }
  20. div.top-container {
  21. padding-top:100px;
  22. background-color: #02709e;
  23. color:#ccc;
  24. }
  25. div.top-container h1 {
  26. color:white;
  27. }
  28. div.top-container a {
  29. color:#ccc;
  30. border-bottom:1px dotted white;
  31. }
  32. div.top-container a:hover {
  33. color: white;
  34. cursor:pointer;
  35. border-bottom:1px solid white;
  36. text-decoration: none;
  37. }
  38. div.top-header {
  39. margin-bottom:100px;
  40. }
  41. h2 {
  42. background-color:#02709e;
  43. color:white;
  44. display:inline-block;
  45. padding:6px;
  46. margin-top:100px;
  47. }
  48. h3 {
  49. padding-bottom:5px;
  50. margin-bottom:10px;
  51. border-bottom:1px solid #f2f2f2;
  52. margin-top: 50px;
  53. }
  54. h4:not(.modal-title) {
  55. margin-top:25px;
  56. }
  57. figure {
  58. position: relative;
  59. }
  60. figure figcaption {
  61. font-size: 22px;
  62. color: #fff;
  63. text-decoration: none;
  64. bottom: 10px;
  65. right: 20px;
  66. position: absolute;
  67. background-color: #000;
  68. }
  69. code[data-code], code.block-code {
  70. display:block;
  71. overflow:scroll;
  72. font-size:12px;
  73. white-space: pre;
  74. }
  75. table {
  76. font-size:12px;
  77. }
  78. .footer {
  79. text-align: center;
  80. }
  81. .footer span {
  82. margin-top:100px;
  83. font-size:12px;
  84. background-color:#02709e;
  85. color:white;
  86. display:inline-block;
  87. padding:6px;
  88. }
  89. .footer span a {
  90. color:#ccc;
  91. border-bottom:1px dotted white;
  92. }
  93. .footer span a:hover {
  94. cursor:pointer;
  95. color: white;
  96. border-bottom:1px solid white;
  97. text-decoration: none;
  98. }
  99. a.anchorjs-link {
  100. color:black;
  101. }
  102. a.anchorjs-link:hover {
  103. color:#02709e;
  104. text-decoration: none;
  105. }
  106. </style>
  107. </head>
  108. <body>
  109. <div class="top-container">
  110. <div class="container">
  111. <div class="row">
  112. <div class="col-md-10 offset-md-1">
  113. <div class="top-header">
  114. <h1>Lightbox for Bootstrap</h1>
  115. <p class="lead">Utilizes Bootstraps modal plugin to implement a lightbox gallery - <a href="//github.com/ashleydw/lightbox">GitHub</a></p>
  116. <div class="text-center">
  117. <iframe src="http://ghbtns.com/github-btn.html?user=ashleydw&repo=lightbox&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100 " height="20"></iframe>
  118. <iframe src="http://ghbtns.com/github-btn.html?user=ashleydw&repo=lightbox&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe>
  119. <iframe src="http://ghbtns.com/github-btn.html?user=ashleydw&repo=lightbox&type=follow&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="160" height="20"></iframe>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="container">
  127. <div class="row">
  128. <div class="col-md-10 offset-md-1">
  129. <h2>Install</h2>
  130. <p>Grab the latest CSS / JS files from the CDN: <a href="https://cdnjs.com/libraries/ekko-lightbox">https://cdnjs.com/libraries/ekko-lightbox</a>.</p>
  131. <p>Or, with bower: <code>bower install ekko-lightbox --save</code></p>
  132. <p>Or, download the files directly: <a href="https://github.com/ashleydw/lightbox/tree/master/dist">https://github.com/ashleydw/lightbox/tree/master/dist</a></p>
  133. <br /><br />
  134. <p>Place this near on your page, probably near the end of the body section:</p>
  135. <code class="block-code">$(document).on('click', '[data-toggle="lightbox"]', function(event) {
  136. event.preventDefault();
  137. $(this).ekkoLightbox();
  138. });</code>
  139. <br /><br />
  140. <p>Then simply add <code>data-toggle</code> to your anchor tags.</p>
  141. <code class="block-code">&lt;a href=&quot;https://unsplash.it/1200/768.jpg?image=251&quot; data-toggle=&quot;lightbox&quot;&gt;
  142. &lt;img src=&quot;https://unsplash.it/600.jpg?image=251&quot; class=&quot;img-fluid&quot;&gt;
  143. &lt;/a&gt;
  144. </code>
  145. <br /><br />
  146. <p>Obviously, you need Bootstrap. Made for Bootstrap v4 but *should* work with v3.</p>
  147. <h2>Options</h2>
  148. <p>Options are passed down to the modal object so you can also use any of the <a href="http://getbootstrap.com/javascript/#modals-usage">original modal options</a>.</p>
  149. <p>Pass the options to the calling function as an object, or set defaults using <code>$.fn.ekkoLightbox.defaults</code> (excluding modal default options, notable: title, footer, remote)</p>
  150. <div class="table-responsive">
  151. <table class="table table-bordered">
  152. <thead>
  153. <tr>
  154. <th>Name</th>
  155. <th>type</th>
  156. <th>default</th>
  157. <th>description</th>
  158. <th>data-*</th>
  159. </tr>
  160. </thead>
  161. <tbody>
  162. <tr>
  163. <td>leftArrow / rightArrow</td>
  164. <td>html</td>
  165. <td><code>&#10094;</code> / <code>&#10095;</code></td>
  166. <td>HTML for the arrows</td>
  167. <td></td>
  168. </tr>
  169. <tr>
  170. <td>wrapping</td>
  171. <td>boolean</td>
  172. <td><code>true</code></td>
  173. <td>Whether the gallery should loop or not</td>
  174. <td></td>
  175. </tr>
  176. <tr>
  177. <td>width / height</td>
  178. <td>integer</td>
  179. <td></td>
  180. <td>Force the width / height</td>
  181. <td><code>data-(width|height)="[0-9]+"</code></td>
  182. </tr>
  183. <tr>
  184. <td>alwaysShowClose</td>
  185. <td>boolean</td>
  186. <td><code>false</code></td>
  187. <td>Always show the close button, even if no title is present</td>
  188. <td></td>
  189. </tr>
  190. <tr>
  191. <td>loadingMessage</td>
  192. <td>html</td>
  193. <td>A fancy loader</td>
  194. <td>HTML injected for loading</td>
  195. <td></td>
  196. </tr>
  197. <tr>
  198. <td>showArrows</td>
  199. <td>bool</td>
  200. <td>true</td>
  201. <td>Disable the navigation overlay</td>
  202. <td></td>
  203. </tr>
  204. </tbody>
  205. </table>
  206. </div>
  207. <code class="block-code">$(this).ekkoLightbox({
  208. alwaysShowClose: true,
  209. onShown: function() {
  210. console.log('Checking our the events huh?');
  211. },
  212. onNavigate: function(direction, itemIndex)
  213. console.log('Navigating '+direction+'. Current item: '+itemIndex);
  214. }
  215. ...
  216. });</code>
  217. <br /><br />
  218. <p>The following options are specified per element.</p>
  219. <div class="table-responsive">
  220. <table class="table table-bordered">
  221. <thead>
  222. <tr>
  223. <th>Name</th>
  224. <th>Description</th>
  225. <th>Example</th>
  226. </tr>
  227. </thead>
  228. <tbody>
  229. <tr>
  230. <td>remote</td>
  231. <td>If you can't/don't want to set the href property of an element</td>
  232. <td><code>data-remote="http://www...."</code></td>
  233. </tr>
  234. <tr>
  235. <td>gallery</td>
  236. <td>For grouping elements</td>
  237. <td><code>data-gallery="gallery-name"</code></td>
  238. </tr>
  239. <tr>
  240. <td>type</td>
  241. <td>Force the lightbox into image/YouTube mode.</td>
  242. <td><code>data-type="(image|youtube|vimeo)"</code></td>
  243. </tr>
  244. <tr>
  245. <td>disable-external-check</td>
  246. <td>Force the lightbox loading into an iframe.</td>
  247. <td><code>data-disable-external-check="(true|false)"</code></td>
  248. </tr>
  249. </tbody>
  250. </table>
  251. </div>
  252. <code class="block-code">&lt;a href=&quot;https://unsplash.it/1200/768.jpg?image=251&quot; data-toggle=&quot;lightbox&quot; data-gallery=&quot;example-gallery&quot; data-type=&quot;image&quot;&gt;
  253. &lt;img src=&quot;https://unsplash.it/600.jpg?image=251&quot; class=&quot;img-fluid&quot;&gt;
  254. &lt;/a&gt;</code>
  255. <h2>Events</h2>
  256. <p>Events can be hooked into, set the the same as options above.</p>
  257. <div class="table-responsive">
  258. <table class="table table-bordered">
  259. <thead>
  260. <tr>
  261. <th>Name</th>
  262. <th>Description</th>
  263. </tr>
  264. </thead>
  265. <tbody>
  266. <tr>
  267. <td>onContentLoaded</td>
  268. <td>Fired when content (image/video/remote page etc) has been fully loaded.</td>
  269. </tr>
  270. <tr>
  271. <td>onNavigate</td>
  272. <td>Fired before navigating a gallery.</td>
  273. </tr>
  274. <tr>
  275. <td>onShow/onShown/onHide/onHidden</td>
  276. <td>Inherited from the bootstrap modal.</td>
  277. </tr>
  278. </tbody>
  279. </table>
  280. </div>
  281. <h2>Examples</h2>
  282. <p>Thanks to <a href="https://unsplash.it/">https://unsplash.it/</a> for the images.</p>
  283. <ul>
  284. <li><a href="#single-image">Single Image</a></li>
  285. <li><a href="#image-gallery">Image Gallery</a></li>
  286. <li><a href="#videos">Videos</a></li>
  287. <li><a href="#videos-gallery">Gallery of Videos</a></li>
  288. <li><a href="#mixed-gallery">Mixed gallery</a></li>
  289. <li><a href="#programatically-call">Programmatically call</a></li>
  290. <li><a href="#data-remote">Via <code>data-remote</code></a></li>
  291. <li><a href="#force-type">Force type</a></li>
  292. <li><a href="#hidden-elements">Hidden elements</a></li>
  293. <li><a href="#remote-content">Remote content</a></li>
  294. <li><a href="#no-wrapping">Disable wrapping</a></li>
  295. </ul>
  296. <h3 id="single-image">Single Image</h3>
  297. <p>Note: uses modal plugin title option via <code>data-title</code>, and the custom footer tag using <code>data-footer</code></p>
  298. <div class="row">
  299. <div class="offset-sm-4 col-sm-3" data-code="example-1">
  300. <a href="https://unsplash.it/1200/768.jpg?image=250" data-toggle="lightbox" data-title="A random title" data-footer="A custom footer text">
  301. <img src="https://unsplash.it/600.jpg?image=250" class="img-fluid">
  302. </a>
  303. </div>
  304. </div>
  305. <code class="html" data-code="example-1"></code>
  306. <h3 id="image-gallery">Image Gallery</h3>
  307. <p>Galleries are created by adding the <code>data-gallery</code> attribute.</p>
  308. <div data-code="example-2">
  309. <div class="row">
  310. <div class="offset-md-2 col-md-8">
  311. <div class="row">
  312. <a href="https://unsplash.it/1200/768.jpg?image=251" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  313. <img src="https://unsplash.it/600.jpg?image=251" class="img-fluid">
  314. </a>
  315. <a href="https://unsplash.it/1200/768.jpg?image=252" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  316. <img src="https://unsplash.it/600.jpg?image=252" class="img-fluid">
  317. </a>
  318. <a href="https://unsplash.it/1200/768.jpg?image=253" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  319. <img src="https://unsplash.it/600.jpg?image=253" class="img-fluid">
  320. </a>
  321. </div>
  322. <div class="row">
  323. <a href="https://unsplash.it/1200/768.jpg?image=254" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  324. <img src="https://unsplash.it/600.jpg?image=254" class="img-fluid">
  325. </a>
  326. <a href="https://unsplash.it/1200/768.jpg?image=255" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  327. <img src="https://unsplash.it/600.jpg?image=255" class="img-fluid">
  328. </a>
  329. <a href="https://unsplash.it/1200/768.jpg?image=256" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  330. <img src="https://unsplash.it/600.jpg?image=256" class="img-fluid">
  331. </a>
  332. </div>
  333. </div>
  334. </div>
  335. </div>
  336. <code class="html" data-code="example-2"></code>
  337. <h3 id="image-gallery">Image Gallery</h3>
  338. <p>Galleries are created by adding the <code>data-gallery</code> attribute.</p>
  339. <div data-code="example-2">
  340. <div class="row">
  341. <div class="offset-md-2 col-md-8">
  342. <div class="row">
  343. <a href="https://unsplash.it/1200/768.jpg?image=251" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  344. <img src="https://unsplash.it/600.jpg?image=251" class="img-fluid">
  345. </a>
  346. <a href="https://unsplash.it/1200/768.jpg?image=252" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  347. <img src="https://unsplash.it/600.jpg?image=252" class="img-fluid">
  348. </a>
  349. <a href="https://unsplash.it/1200/768.jpg?image=253" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  350. <img src="https://unsplash.it/600.jpg?image=253" class="img-fluid">
  351. </a>
  352. </div>
  353. <div class="row">
  354. <a href="https://unsplash.it/1200/768.jpg?image=254" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  355. <img src="https://unsplash.it/600.jpg?image=254" class="img-fluid">
  356. </a>
  357. <a href="https://unsplash.it/1200/768.jpg?image=255" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  358. <img src="https://unsplash.it/600.jpg?image=255" class="img-fluid">
  359. </a>
  360. <a href="https://unsplash.it/1200/768.jpg?image=256" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  361. <img src="https://unsplash.it/600.jpg?image=256" class="img-fluid">
  362. </a>
  363. </div>
  364. </div>
  365. </div>
  366. </div>
  367. <code class="html" data-code="example-2"></code>
  368. <h3 id="videos">Videos</h3>
  369. <h4>YouTube</h4>
  370. <p>You can use various YouTube URL formats, the regex used is: <code>/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/</code></p>
  371. <div data-code="example-3">
  372. <p><a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" data-toggle="lightbox">Justin Bieber - Love Yourself</a></p>
  373. <p><a href="http://youtu.be/b0jqPvpn3sY" data-toggle="lightbox">Tame Impala - Elephant (using youtu.be link)</a></p>
  374. <p><a href="https://www.youtube.com/watch?v=oyEuk8j8imI&rel=0" data-toggle="lightbox">Justin Bieber - Love Yourself</a> (suppress related videos with <code>&rel=0</code>)</p>
  375. </div>
  376. <code data-code="example-3" data-trim="all"></code>
  377. <h4>Vimeo</h4>
  378. <p>You cannot embed Vimeo videos using the standard url (ie http://vimeo.com/80629469); you must link to the embed source (ie player.vimeo.com/video/80629469). This will mean your link url - if the JavaScript fails, will open the full screen player (try opening the first link below in a new tab); the solution to this is to set the lightbox source directly - the second link below does this.</p>
  379. <div data-code="example-3-b">
  380. <p><a href="http://player.vimeo.com/video/80629469" data-toggle="lightbox">City Lights - from Colin Rich (using embed link)</a></p>
  381. <p><a href="http://vimeo.com/80629469" data-remote="http://player.vimeo.com/video/80629469" data-toggle="lightbox">City Lights - from Colin Rich</a> (with reccommended <code>data-remote</code> setting)</p>
  382. </div>
  383. <code data-code="example-3-b" data-trim="all"></code>
  384. <h4>Instagram</h4>
  385. <p></p>
  386. <div data-code="example-3-c">
  387. <p><a href="http://instagram.com/p/BRCYe_wD9pV/" data-toggle="lightbox" data-title="Plug for our new service">Instagram</a></p>
  388. <p>This also works with photos: <a href="//instagram.com/p/BRCdyxnjBsA/" data-toggle="lightbox">Instagram</a></p>
  389. </div>
  390. <code data-code="example-3-c" data-trim="all"></code>
  391. <h4>Forcing width</h4>
  392. <p>Set the width of the video</p>
  393. <div data-code="example-3-d">
  394. <p><a href="https://www.youtube.com/watch?v=e-ORhEE9VVg" data-toggle="lightbox">Taylor Swift - Blank Space (standard)</a></p>
  395. <p><a href="https://www.youtube.com/watch?v=e-ORhEE9VVg" data-toggle="lightbox" data-width="640">Taylor Swift - Blank Space (640 x 360)</a></p>
  396. <p><a href="https://www.youtube.com/watch?v=e-ORhEE9VVg" data-toggle="lightbox" data-width="1280">Taylor Swift - Blank Space (1280 x 780)</a></p>
  397. </div>
  398. <code data-code="example-3-d" data-trim="all"></code>
  399. <!-- i hope your coworkers think you're listening to some justin and taylor -->
  400. <h3 id="videos-gallery">Gallery of Videos</h3>
  401. <div class="row">
  402. <div class="offset-md-1 col-md-10">
  403. <div class="row" data-code="example-4">
  404. <a href="http://www.youtube.com/watch?v=k6mFF3VmVAs" data-toggle="lightbox" data-gallery="youtubevideos" class="col-sm-4">
  405. <img src="//i1.ytimg.com/vi/yP11r5n5RNg/mqdefault.jpg" class="img-fluid">
  406. </a>
  407. <a href="http://youtu.be/iQ4D273C7Ac" data-toggle="lightbox" data-gallery="youtubevideos" class="col-sm-4">
  408. <img src="//i1.ytimg.com/vi/iQ4D273C7Ac/mqdefault.jpg" class="img-fluid">
  409. </a>
  410. <a href="//www.youtube.com/embed/b0jqPvpn3sY" data-toggle="lightbox" data-gallery="youtubevideos" class="col-sm-4">
  411. <img src="//i1.ytimg.com/vi/b0jqPvpn3sY/mqdefault.jpg" class="img-fluid">
  412. </a>
  413. </div>
  414. </div>
  415. </div>
  416. <code data-code="example-4"></code>
  417. <h3 id="mixed-gallery">Mixed gallery</h3>
  418. <div class="row">
  419. <div class="offset-md-1 col-md-10">
  420. <div class="row flex-items-xs-center" data-code="example-5">
  421. <a href="http://www.youtube.com/watch?v=k6mFF3VmVAs" data-toggle="lightbox" data-gallery="mixedgallery" class="col-sm-4">
  422. <img src="//i1.ytimg.com/vi/yP11r5n5RNg/mqdefault.jpg" class="img-fluid">
  423. </a>
  424. <a href="https://unsplash.it/1200/768.jpg?image=257" data-toggle="lightbox" data-gallery="mixedgallery" class="col-sm-4">
  425. <img src="https://unsplash.it/600.jpg?image=257" class="img-fluid">
  426. </a>
  427. <a href="http://vimeo.com/80629469" data-remote="http://player.vimeo.com/video/80629469" data-toggle="lightbox" data-gallery="mixedgallery" class="col-sm-4">
  428. <img src="//b.vimeocdn.com/ts/458/070/458070637_200.jpg" class="img-fluid">
  429. </a>
  430. </div>
  431. </div>
  432. </div>
  433. <code data-code="example-5"></code>
  434. <h3 id="programatically-call">Programmatically call</h3>
  435. <p>These two examples are opened via the JavaScript at the bottom of the source.</p>
  436. <div class="row">
  437. <div class="offset-md-1 col-md-10">
  438. <div class="row" data-code="example-6">
  439. <a href="https://unsplash.it/1200/768.jpg?image=258" id="open-image" class="col-sm-4">
  440. <img src="https://unsplash.it/600.jpg?image=258" class="img-fluid">
  441. </a>
  442. <a href="http://youtu.be/iQ4D273C7Ac" id="open-youtube" class="col-sm-4">
  443. <img src="//i1.ytimg.com/vi/iQ4D273C7Ac/mqdefault.jpg" class="img-fluid">
  444. </a>
  445. </div>
  446. </div>
  447. </div>
  448. <code data-code="example-6"></code>
  449. <code class="block-code">$(&#39;#open-image&#39;).click(function (e) {
  450. e.preventDefault();
  451. $(this).ekkoLightbox();
  452. });
  453. $(&#39;#open-youtube&#39;).click(function (e) {
  454. e.preventDefault();
  455. $(this).ekkoLightbox();
  456. });</code>
  457. <h3 id="data-remote">Via <code>data-remote</code></h3>
  458. <p>Neither of these are <code>&lt;a /&gt;</code> tags, so both rely on the <code>data-remote</code> attribute.</p>
  459. <div class="row">
  460. <div class="offset-md-1 col-md-10">
  461. <div class="row" data-code="example-7" style="height:200px">
  462. <img src="https://unsplash.it/600.jpg?image=259" data-toggle="lightbox" data-remote="https://unsplash.it/1200/768.jpg?image=259" class="img-fluid col-sm-4">
  463. <img src="//i1.ytimg.com/vi/b0jqPvpn3sY/mqdefault.jpg" data-toggle="lightbox" data-remote="//www.youtube.com/embed/b0jqPvpn3sY" class="img-fluid col-sm-4">
  464. </div>
  465. </div>
  466. </div>
  467. <code data-code="example-7"></code>
  468. <h3 id="force-type">Force type</h3>
  469. <p>If the images you are linking to have no extension, the lightbox cannot detect that is an image; therefore you need to tell the lightbox what <code>data-type</code> it is.</p>
  470. <p>Current allowed types are: <code>['image', 'youtube', 'vimeo', 'instagram', 'video', 'url']</code></p>
  471. <div data-code="example-8">
  472. <p><a href="https://unsplash.it/1200/768?image=260" data-title="Force image display" data-footer="The remote of this modal has no extension (https://unsplash.it/1200/768?image=260) but works because the type is forced." data-toggle="lightbox" data-type="image">Click here for an image, but with no extension.</a></p>
  473. <p><a href="https://unsplash.it/1200/768?image=261" data-footer="Without the type forced, the lightbox will remote load the content" data-toggle="lightbox">This link is missing the type attribute, and will iframe the image.</a></p>
  474. <p><a href="http://www.youtube.com/watch?v=b0jqPvpn3sY" data-toggle="lightbox" data-type="image">This link is linking to a YouTube video, but forcing an image.</a></p>
  475. </div>
  476. <code data-code="example-8"></code>
  477. <h3 id="hidden-elements">Hidden elements</h3>
  478. <p>Facebook style, only show a few images but have a large gallery</p>
  479. <div class="row">
  480. <div class="offset-md-2 col-md-8">
  481. <div class="row" data-code="example-9">
  482. <a href="https://unsplash.it/1200/768.jpg?image=263" data-toggle="lightbox" data-gallery="hidden-images" class="col-sm-4">
  483. <img src="https://unsplash.it/600.jpg?image=263" class="img-fluid">
  484. </a>
  485. <a href="https://unsplash.it/1200/768.jpg?image=264" data-toggle="lightbox" data-gallery="hidden-images" class="col-sm-4">
  486. <img src="https://unsplash.it/600.jpg?image=264" class="img-fluid">
  487. </a>
  488. <a href="https://unsplash.it/1200/768.jpg?image=265" data-toggle="lightbox" data-gallery="hidden-images" class="col-sm-4">
  489. <img src="https://unsplash.it/600.jpg?image=265" class="img-fluid">
  490. </a>
  491. <!-- elements not showing, use data-remote -->
  492. <div data-toggle="lightbox" data-gallery="hidden-images" data-remote="https://unsplash.it/1200/768.jpg?image=264" data-title="Hidden item 1"></div>
  493. <div data-toggle="lightbox" data-gallery="hidden-images" data-remote="//www.youtube.com/embed/b0jqPvpn3sY" data-title="Hidden item 2"></div>
  494. <div data-toggle="lightbox" data-gallery="hidden-images" data-remote="https://unsplash.it/1200/768.jpg?image=265" data-title="Hidden item 3"></div>
  495. <div data-toggle="lightbox" data-gallery="hidden-images" data-remote="https://unsplash.it/1200/768.jpg?image=266" data-title="Hidden item 4"></div>
  496. <div data-toggle="lightbox" data-gallery="hidden-images" data-remote="https://unsplash.it/1200/768.jpg?image=267" data-title="Hidden item 5"></div>
  497. </div>
  498. </div>
  499. </div>
  500. <code data-code="example-9"></code>
  501. <h3 id="remote-content">Remote content</h3>
  502. <p>Given a URL, that is not an image or video (including unforced types), load the content using an iFrame.</p>
  503. <div class="row">
  504. <div class="offset-md-1 col-md-10" data-code="example-10">
  505. <div class="row">
  506. <p class="col-sm-3"><a href="http://getbootstrap.com" data-title="Bootstrap" data-width="1200" data-toggle="lightbox" data-gallery="remoteload">Bootstrap Docs</a></p>
  507. </div>
  508. </div>
  509. </div>
  510. <code data-code="example-10"></code>
  511. <h3 id="no-wrapping">Disable wrapping</h3>
  512. <p>To disable wrapping, set `wrapping` to false when creating a gallery.</p>
  513. <div>
  514. <div class="row">
  515. <div class="offset-md-2 col-md-8">
  516. <div class="row">
  517. <a href="https://unsplash.it/1200/768.jpg?image=251" data-toggle="lightbox" data-gallery="example-gallery-11" class="col-sm-4">
  518. <img src="https://unsplash.it/600.jpg?image=251" class="img-fluid">
  519. </a>
  520. <a href="https://unsplash.it/1200/768.jpg?image=252" data-toggle="lightbox" data-gallery="example-gallery-11" class="col-sm-4">
  521. <img src="https://unsplash.it/600.jpg?image=252" class="img-fluid">
  522. </a>
  523. <a href="https://unsplash.it/1200/768.jpg?image=253" data-toggle="lightbox" data-gallery="example-gallery-11" class="col-sm-4">
  524. <img src="https://unsplash.it/600.jpg?image=253" class="img-fluid">
  525. </a>
  526. </div>
  527. <div class="row">
  528. <a href="https://unsplash.it/1200/768.jpg?image=254" data-toggle="lightbox" data-gallery="example-gallery-11" class="col-sm-4">
  529. <img src="https://unsplash.it/600.jpg?image=254" class="img-fluid">
  530. </a>
  531. <a href="https://unsplash.it/1200/768.jpg?image=255" data-toggle="lightbox" data-gallery="example-gallery-11" class="col-sm-4">
  532. <img src="https://unsplash.it/600.jpg?image=255" class="img-fluid">
  533. </a>
  534. <a href="https://unsplash.it/1200/768.jpg?image=256" data-toggle="lightbox" data-gallery="example-gallery-11" class="col-sm-4">
  535. <img src="https://unsplash.it/600.jpg?image=256" class="img-fluid">
  536. </a>
  537. </div>
  538. </div>
  539. </div>
  540. </div>
  541. <code class="html" data-code>$(this).ekkoLightbox({ wrapping: false });</code>
  542. <p class="footer"><span>Built by me, <a href="https://ashleyd.ws">ashleydw</a></span></p>
  543. </div>
  544. </div>
  545. </div>
  546. <script src="//ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha384-THPy051/pYDQGanwU6poAc/hOdQxjnOEXzbT+OuUAFqNqFjL+4IGLBgCJC3ZOShY" crossorigin="anonymous"></script>
  547. <script src="//cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js" integrity="sha384-Plbmg8JY28KFelvJVai01l8WyZzrYWG825m+cZ0eDDS1f7d/js6ikvy1+X+guPIB" crossorigin="anonymous"></script>
  548. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
  549. <script src="../dist/ekko-lightbox.js"></script>
  550. <!-- for documentation only -->
  551. <script src="//cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.1/anchor.min.js"></script>
  552. <script type="text/javascript">
  553. $(document).ready(function ($) {
  554. // delegate calls to data-toggle="lightbox"
  555. $(document).on('click', '[data-toggle="lightbox"]:not([data-gallery="navigateTo"]):not([data-gallery="example-gallery-11"])', function(event) {
  556. event.preventDefault();
  557. return $(this).ekkoLightbox({
  558. onShown: function() {
  559. if (window.console) {
  560. return console.log('Checking our the events huh?');
  561. }
  562. },
  563. onNavigate: function(direction, itemIndex) {
  564. if (window.console) {
  565. return console.log('Navigating '+direction+'. Current item: '+itemIndex);
  566. }
  567. }
  568. });
  569. });
  570. // disable wrapping
  571. $(document).on('click', '[data-toggle="lightbox"][data-gallery="example-gallery-11"]', function(event) {
  572. event.preventDefault();
  573. return $(this).ekkoLightbox({
  574. wrapping: false
  575. });
  576. });
  577. //Programmatically call
  578. $('#open-image').click(function (e) {
  579. e.preventDefault();
  580. $(this).ekkoLightbox();
  581. });
  582. $('#open-youtube').click(function (e) {
  583. e.preventDefault();
  584. $(this).ekkoLightbox();
  585. });
  586. // navigateTo
  587. $(document).on('click', '[data-toggle="lightbox"][data-gallery="navigateTo"]', function(event) {
  588. event.preventDefault();
  589. return $(this).ekkoLightbox({
  590. onShown: function() {
  591. this.modal().on('click', '.modal-footer a', function(e) {
  592. e.preventDefault();
  593. this.navigateTo(2);
  594. }.bind(this));
  595. }
  596. });
  597. });
  598. /**
  599. * Documentation specific - ignore this
  600. */
  601. anchors.options.placement = 'left';
  602. anchors.add('h3');
  603. $('code[data-code]').each(function() {
  604. var $code = $(this),
  605. $pair = $('div[data-code="'+$code.data('code')+'"]');
  606. $code.hide();
  607. var text = $code.text($pair.html()).html().trim().split("\n");
  608. var indentLength = text[text.length - 1].match(/^\s+/)
  609. indentLength = indentLength ? indentLength[0].length : 24;
  610. var indent = '';
  611. for(var i = 0; i < indentLength; i++)
  612. indent += ' ';
  613. if($code.data('trim') == 'all') {
  614. for (var i = 0; i < text.length; i++)
  615. text[i] = text[i].trim();
  616. } else {
  617. for (var i = 0; i < text.length; i++)
  618. text[i] = text[i].replace(indent, ' ').replace(' ', '');
  619. }
  620. text = text.join("\n");
  621. $code.html(text).show();
  622. });
  623. });
  624. </script>
  625. </body>
  626. </html>