bs3.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  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="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/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 {
  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="bs3-notice">
  110. <p><strong>NB!:</strong> This page is intended to demonstrate that the lightbox works with Bootstrap 3 - the CSS classes for the layout use BS4 so this page won't display correctly.</p>
  111. <p>Use this page only to check the lightbox works with BS3.</p>
  112. </div>
  113. <div class="top-container">
  114. <div class="container">
  115. <div class="row">
  116. <div class="col-md-10 offset-md-1">
  117. <div class="top-header">
  118. <h1>Lightbox for Bootstrap</h1>
  119. <p class="lead">Utilizes Bootstraps modal plugin to implement a lightbox gallery - <a href="//github.com/ashleydw/lightbox">GitHub</a></p>
  120. <div class="text-center">
  121. <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>
  122. <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>
  123. <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>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="container">
  131. <div class="row">
  132. <div class="col-md-10 offset-md-1">
  133. <h2>Install</h2>
  134. <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>
  135. <p>Or, with bower: <code>bower install ekko-lightbox --save</code></p>
  136. <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>
  137. <br /><br />
  138. <p>Place this near on your page, probably near the end of the body section:</p>
  139. <code class="block-code">$(document).on('click', '[data-toggle="lightbox"]', function(event) {
  140. event.preventDefault();
  141. $(this).ekkoLightbox();
  142. });</code>
  143. <br /><br />
  144. <p>Then simply add <code>data-toggle</code> to your anchor tags.</p>
  145. <code class="block-code">&lt;a href=&quot;https://unsplash.it/1200/768.jpg?image=251&quot; data-toggle=&quot;lightbox&quot;&gt;
  146. &lt;img src=&quot;https://unsplash.it/600.jpg?image=251&quot; class=&quot;img-fluid&quot;&gt;
  147. &lt;/a&gt;
  148. </code>
  149. <br /><br />
  150. <p>Obviously, you need Bootstrap. Made for Bootstrap v4 but *should* work with v3.</p>
  151. <h2>Options</h2>
  152. <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>
  153. <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>
  154. <div class="table-responsive">
  155. <table class="table table-bordered">
  156. <thead>
  157. <tr>
  158. <th>Name</th>
  159. <th>type</th>
  160. <th>default</th>
  161. <th>description</th>
  162. <th>data-*</th>
  163. </tr>
  164. </thead>
  165. <tbody>
  166. <tr>
  167. <td>leftArrow / rightArrow</td>
  168. <td>html</td>
  169. <td><code>&#10094;</code> / <code>&#10095;</code></td>
  170. <td>HTML for the arrows</td>
  171. <td></td>
  172. </tr>
  173. <tr>
  174. <td>width / height</td>
  175. <td>integer</td>
  176. <td></td>
  177. <td>Force the width / height</td>
  178. <td><code>data-(width|height)="[0-9]+"</code></td>
  179. </tr>
  180. <tr>
  181. <td>alwaysShowClose</td>
  182. <td>boolean</td>
  183. <td><code>false</code></td>
  184. <td>Always show the close button, even if no title is present</td>
  185. <td></td>
  186. </tr>
  187. <tr>
  188. <td>loadingMessage</td>
  189. <td>html</td>
  190. <td>A fancy loader</td>
  191. <td>HTML injected for loading</td>
  192. <td></td>
  193. </tr>
  194. <tr>
  195. <td>showArrows</td>
  196. <td>bool</td>
  197. <td>true</td>
  198. <td>Disable the navigation overlay</td>
  199. <td></td>
  200. </tr>
  201. </tbody>
  202. </table>
  203. </div>
  204. <code class="block-code">$(this).ekkoLightbox({
  205. alwaysShowClose: true,
  206. onShown: function() {
  207. console.log('Checking our the events huh?');
  208. },
  209. onNavigate: function(direction, itemIndex)
  210. console.log('Navigating '+direction+'. Current item: '+itemIndex);
  211. }
  212. ...
  213. });</code>
  214. <br /><br />
  215. <p>The following options are specified per element.</p>
  216. <div class="table-responsive">
  217. <table class="table table-bordered">
  218. <thead>
  219. <tr>
  220. <th>Name</th>
  221. <th>Description</th>
  222. <th>Example</th>
  223. </tr>
  224. </thead>
  225. <tbody>
  226. <tr>
  227. <td>remote</td>
  228. <td>If you can't/don't want to set the href property of an element</td>
  229. <td><code>data-remote="http://www...."</code></td>
  230. </tr>
  231. <tr>
  232. <td>gallery</td>
  233. <td>For grouping elements</td>
  234. <td><code>data-gallery="gallery-name"</code></td>
  235. </tr>
  236. <tr>
  237. <td>type</td>
  238. <td>Force the lightbox into image/YouTube mode.</td>
  239. <td><code>data-type="(image|youtube|vimeo)"</code></td>
  240. </tr>
  241. </tbody>
  242. </table>
  243. </div>
  244. <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;
  245. &lt;img src=&quot;https://unsplash.it/600.jpg?image=251&quot; class=&quot;img-fluid&quot;&gt;
  246. &lt;/a&gt;</code>
  247. <h2>Events</h2>
  248. <p>Events can be hooked into, set the the same as options above.</p>
  249. <div class="table-responsive">
  250. <table class="table table-bordered">
  251. <thead>
  252. <tr>
  253. <th>Name</th>
  254. <th>Description</th>
  255. </tr>
  256. </thead>
  257. <tbody>
  258. <tr>
  259. <td>onContentLoaded</td>
  260. <td>Fired when content (image/video/remote page etc) has been fully loaded.</td>
  261. </tr>
  262. <tr>
  263. <td>onNavigate</td>
  264. <td>Fired before navigating a gallery.</td>
  265. </tr>
  266. <tr>
  267. <td>onShow/onShown/onHide/onHidden</td>
  268. <td>Inherited from the bootstrap modal.</td>
  269. </tr>
  270. </tbody>
  271. </table>
  272. </div>
  273. <h2>Examples</h2>
  274. <p>Thanks to <a href="https://unsplash.it/">https://unsplash.it/</a> for the images.</p>
  275. <ul>
  276. <li><a href="#single-image">Single Image</a></li>
  277. <li><a href="#image-gallery">Image Gallery</a></li>
  278. <li><a href="#videos">Videos</a></li>
  279. <li><a href="#videos-gallery">Gallery of Videos</a></li>
  280. <li><a href="#mixed-gallery">Mixed gallery</a></li>
  281. <li><a href="#programatically-call">Programmatically call</a></li>
  282. <li><a href="#data-remote">Via <code>data-remote</code></a></li>
  283. <li><a href="#force-type">Force type</a></li>
  284. <li><a href="#hidden-elements">Hidden elements</a></li>
  285. <li><a href="#remote-content">Remote content</a></li>
  286. </ul>
  287. <h3 id="single-image">Single Image</h3>
  288. <p>Note: uses modal plugin title option via <code>data-title</code>, and the custom footer tag using <code>data-footer</code></p>
  289. <div class="row">
  290. <div class="offset-sm-4 col-sm-3" data-code="example-1">
  291. <a href="https://unsplash.it/1200/768.jpg?image=250" data-toggle="lightbox" data-title="A random title" data-footer="A custom footer text">
  292. <img src="https://unsplash.it/600.jpg?image=250" class="img-fluid">
  293. </a>
  294. </div>
  295. </div>
  296. <code class="html" data-code="example-1"></code>
  297. <h3 id="image-gallery">Image Gallery</h3>
  298. <p>Galleries are created by adding the <code>data-gallery</code> attribute.</p>
  299. <div data-code="example-2">
  300. <div class="row">
  301. <div class="offset-md-2 col-md-8">
  302. <div class="row">
  303. <a href="https://unsplash.it/1200/768.jpg?image=251" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  304. <img src="https://unsplash.it/600.jpg?image=251" class="img-fluid">
  305. </a>
  306. <a href="https://unsplash.it/1200/768.jpg?image=252" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  307. <img src="https://unsplash.it/600.jpg?image=252" class="img-fluid">
  308. </a>
  309. <a href="https://unsplash.it/1200/768.jpg?image=253" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  310. <img src="https://unsplash.it/600.jpg?image=253" class="img-fluid">
  311. </a>
  312. </div>
  313. <div class="row">
  314. <a href="https://unsplash.it/1200/768.jpg?image=254" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  315. <img src="https://unsplash.it/600.jpg?image=254" class="img-fluid">
  316. </a>
  317. <a href="https://unsplash.it/1200/768.jpg?image=255" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  318. <img src="https://unsplash.it/600.jpg?image=255" class="img-fluid">
  319. </a>
  320. <a href="https://unsplash.it/1200/768.jpg?image=256" data-toggle="lightbox" data-gallery="example-gallery" class="col-sm-4">
  321. <img src="https://unsplash.it/600.jpg?image=256" class="img-fluid">
  322. </a>
  323. </div>
  324. </div>
  325. </div>
  326. </div>
  327. <code class="html" data-code="example-2"></code>
  328. <h3 id="videos">Videos</h3>
  329. <h4>YouTube</h4>
  330. <p>You can use various YouTube URL formats, the regex used is: <code>/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/</code></p>
  331. <div data-code="example-3">
  332. <p><a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" data-toggle="lightbox">Justin Bieber - Love Yourself</a></p>
  333. <p><a href="http://youtu.be/b0jqPvpn3sY" data-toggle="lightbox">Tame Impala - Elephant (using youtu.be link)</a></p>
  334. <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>
  335. </div>
  336. <code data-code="example-3" data-trim="all"></code>
  337. <h4>Vimeo</h4>
  338. <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>
  339. <div data-code="example-3-b">
  340. <p><a href="http://player.vimeo.com/video/80629469" data-toggle="lightbox">City Lights - from Colin Rich (using embed link)</a></p>
  341. <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>
  342. </div>
  343. <code data-code="example-3-b" data-trim="all"></code>
  344. <h4>Instagram</h4>
  345. <p></p>
  346. <div data-code="example-3-c">
  347. <p><a href="http://instagram.com/p/pZfG1fPfuX/" data-toggle="lightbox" data-title="Plug for our new service">GOtags.co.uk</a></p>
  348. <p>This also works with photos: <a href="//instagram.com/p/0wbypvPfmQ/" data-toggle="lightbox">GOtags.co.uk</a></p>
  349. </div>
  350. <code data-code="example-3-c" data-trim="all"></code>
  351. <h4>Forcing width</h4>
  352. <p>Set the width of the video</p>
  353. <div data-code="example-3-d">
  354. <p><a href="https://www.youtube.com/watch?v=e-ORhEE9VVg" data-toggle="lightbox">Taylor Swift - Blank Space (standard)</a></p>
  355. <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>
  356. <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>
  357. </div>
  358. <code data-code="example-3-d" data-trim="all"></code>
  359. <!-- i hope your coworkers think you're listening to some justin and taylor -->
  360. <h3 id="videos-gallery">Gallery of Videos</h3>
  361. <div class="row">
  362. <div class="offset-md-1 col-md-10">
  363. <div class="row" data-code="example-4">
  364. <a href="http://www.youtube.com/watch?v=k6mFF3VmVAs" data-toggle="lightbox" data-gallery="youtubevideos" class="col-sm-4">
  365. <img src="//i1.ytimg.com/vi/yP11r5n5RNg/mqdefault.jpg" class="img-fluid">
  366. </a>
  367. <a href="http://youtu.be/iQ4D273C7Ac" data-toggle="lightbox" data-gallery="youtubevideos" class="col-sm-4">
  368. <img src="//i1.ytimg.com/vi/iQ4D273C7Ac/mqdefault.jpg" class="img-fluid">
  369. </a>
  370. <a href="//www.youtube.com/embed/b0jqPvpn3sY" data-toggle="lightbox" data-gallery="youtubevideos" class="col-sm-4">
  371. <img src="//i1.ytimg.com/vi/b0jqPvpn3sY/mqdefault.jpg" class="img-fluid">
  372. </a>
  373. </div>
  374. </div>
  375. </div>
  376. <code data-code="example-4"></code>
  377. <h3 id="mixed-gallery">Mixed gallery</h3>
  378. <div class="row">
  379. <div class="offset-md-1 col-md-10">
  380. <div class="row flex-items-xs-center" data-code="example-5">
  381. <a href="http://www.youtube.com/watch?v=k6mFF3VmVAs" data-toggle="lightbox" data-gallery="mixedgallery" class="col-sm-4">
  382. <img src="//i1.ytimg.com/vi/yP11r5n5RNg/mqdefault.jpg" class="img-fluid">
  383. </a>
  384. <a href="https://unsplash.it/1200/768.jpg?image=257" data-toggle="lightbox" data-gallery="mixedgallery" class="col-sm-4">
  385. <img src="https://unsplash.it/600.jpg?image=257" class="img-fluid">
  386. </a>
  387. <a href="http://vimeo.com/80629469" data-remote="http://player.vimeo.com/video/80629469" data-toggle="lightbox" data-gallery="mixedgallery" class="col-sm-4">
  388. <img src="//b.vimeocdn.com/ts/458/070/458070637_200.jpg" class="img-fluid">
  389. </a>
  390. </div>
  391. </div>
  392. </div>
  393. <code data-code="example-5"></code>
  394. <h3 id="programatically-call">Programmatically call</h3>
  395. <p>These two examples are opened via the JavaScript at the bottom of the source.</p>
  396. <div class="row">
  397. <div class="offset-md-1 col-md-10">
  398. <div class="row" data-code="example-6">
  399. <a href="https://unsplash.it/1200/768.jpg?image=258" id="open-image" class="col-sm-4">
  400. <img src="https://unsplash.it/600.jpg?image=258" class="img-fluid">
  401. </a>
  402. <a href="http://youtu.be/iQ4D273C7Ac" id="open-youtube" class="col-sm-4">
  403. <img src="//i1.ytimg.com/vi/iQ4D273C7Ac/mqdefault.jpg" class="img-fluid">
  404. </a>
  405. </div>
  406. </div>
  407. </div>
  408. <code data-code="example-6"></code>
  409. <code class="block-code">$(&#39;#open-image&#39;).click(function (e) {
  410. e.preventDefault();
  411. $(this).ekkoLightbox();
  412. });
  413. $(&#39;#open-youtube&#39;).click(function (e) {
  414. e.preventDefault();
  415. $(this).ekkoLightbox();
  416. });</code>
  417. <h3 id="data-remote">Via <code>data-remote</code></h3>
  418. <p>Neither of these are <code>&lt;a /&gt;</code> tags, so both rely on the <code>data-remote</code> attribute.</p>
  419. <div class="row">
  420. <div class="offset-md-1 col-md-10">
  421. <div class="row" data-code="example-7">
  422. <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">
  423. <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">
  424. </div>
  425. </div>
  426. </div>
  427. <code data-code="example-7"></code>
  428. <h3 id="force-type">Force type</h3>
  429. <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>
  430. <p>Current allowed types are: <code>['image', 'youtube', 'vimeo', 'instagram', 'video', 'url']</code></p>
  431. <div data-code="example-8">
  432. <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>
  433. <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>
  434. <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>
  435. </div>
  436. <code data-code="example-8"></code>
  437. <h3 id="hidden-elements">Hidden elements</h3>
  438. <p>Facebook style, only show a few images but have a large gallery</p>
  439. <div class="row">
  440. <div class="offset-md-2 col-md-8">
  441. <div class="row" data-code="example-9">
  442. <a href="https://unsplash.it/1200/768.jpg?image=263" data-toggle="lightbox" data-gallery="hidden-images" class="col-sm-4">
  443. <img src="https://unsplash.it/600.jpg?image=263" class="img-fluid">
  444. </a>
  445. <a href="https://unsplash.it/1200/768.jpg?image=264" data-toggle="lightbox" data-gallery="hidden-images" class="col-sm-4">
  446. <img src="https://unsplash.it/600.jpg?image=264" class="img-fluid">
  447. </a>
  448. <a href="https://unsplash.it/1200/768.jpg?image=265" data-toggle="lightbox" data-gallery="hidden-images" class="col-sm-4">
  449. <img src="https://unsplash.it/600.jpg?image=265" class="img-fluid">
  450. </a>
  451. <!-- elements not showing, use data-remote -->
  452. <div data-toggle="lightbox" data-gallery="hidden-images" data-remote="https://unsplash.it/1200/768.jpg?image=264" data-title="Hidden item 1"></div>
  453. <div data-toggle="lightbox" data-gallery="hidden-images" data-remote="//www.youtube.com/embed/b0jqPvpn3sY" data-title="Hidden item 2"></div>
  454. <div data-toggle="lightbox" data-gallery="hidden-images" data-remote="https://unsplash.it/1200/768.jpg?image=265" data-title="Hidden item 3"></div>
  455. <div data-toggle="lightbox" data-gallery="hidden-images" data-remote="https://unsplash.it/1200/768.jpg?image=266" data-title="Hidden item 4"></div>
  456. <div data-toggle="lightbox" data-gallery="hidden-images" data-remote="https://unsplash.it/1200/768.jpg?image=267" data-title="Hidden item 5"></div>
  457. </div>
  458. </div>
  459. </div>
  460. <code data-code="example-9"></code>
  461. <h3 id="remote-content">Remote content</h3>
  462. <p>Given a URL, that is not an image or video (including unforced types), load the content using an iFrame.</p>
  463. <div class="row">
  464. <div class="offset-md-1 col-md-10" data-code="example-10">
  465. <div class="row">
  466. <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>
  467. </div>
  468. </div>
  469. </div>
  470. <code data-code="example-10"></code>
  471. <p class="footer"><span>Built by me, <a href="https://ashleyd.ws">ashleydw</a></span></p>
  472. </div>
  473. </div>
  474. </div>
  475. <script src="//ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha384-THPy051/pYDQGanwU6poAc/hOdQxjnOEXzbT+OuUAFqNqFjL+4IGLBgCJC3ZOShY" crossorigin="anonymous"></script>
  476. <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>
  477. <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  478. <script src="../dist/ekko-lightbox.js"></script>
  479. <!-- for documentation only -->
  480. <script src="//cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.1/anchor.min.js"></script>
  481. <script type="text/javascript">
  482. $(document).ready(function ($) {
  483. // delegate calls to data-toggle="lightbox"
  484. $(document).on('click', '[data-toggle="lightbox"]:not([data-gallery="navigateTo"])', function(event) {
  485. event.preventDefault();
  486. return $(this).ekkoLightbox({
  487. onShown: function() {
  488. if (window.console) {
  489. return console.log('Checking our the events huh?');
  490. }
  491. },
  492. onNavigate: function(direction, itemIndex) {
  493. if (window.console) {
  494. return console.log('Navigating '+direction+'. Current item: '+itemIndex);
  495. }
  496. }
  497. });
  498. });
  499. //Programmatically call
  500. $('#open-image').click(function (e) {
  501. e.preventDefault();
  502. $(this).ekkoLightbox();
  503. });
  504. $('#open-youtube').click(function (e) {
  505. e.preventDefault();
  506. $(this).ekkoLightbox();
  507. });
  508. // navigateTo
  509. $(document).on('click', '[data-toggle="lightbox"][data-gallery="navigateTo"]', function(event) {
  510. event.preventDefault();
  511. return $(this).ekkoLightbox({
  512. onShown: function() {
  513. this.modal().on('click', '.modal-footer a', function(e) {
  514. e.preventDefault();
  515. this.navigateTo(2);
  516. }.bind(this));
  517. }
  518. });
  519. });
  520. /**
  521. * Documentation specific - ignore this
  522. */
  523. anchors.options.placement = 'left';
  524. anchors.add('h3');
  525. $('code[data-code]').each(function() {
  526. var $code = $(this),
  527. $pair = $('div[data-code="'+$code.data('code')+'"]');
  528. $code.hide();
  529. var text = $code.text($pair.html()).html().trim().split("\n");
  530. var indentLength = text[text.length - 1].match(/^\s+/)
  531. indentLength = indentLength ? indentLength[0].length : 24;
  532. var indent = '';
  533. for(var i = 0; i < indentLength; i++)
  534. indent += ' ';
  535. if($code.data('trim') == 'all') {
  536. for (var i = 0; i < text.length; i++)
  537. text[i] = text[i].trim();
  538. } else {
  539. for (var i = 0; i < text.length; i++)
  540. text[i] = text[i].replace(indent, ' ').replace(' ', '');
  541. }
  542. text = text.join("\n");
  543. $code.html(text).show();
  544. });
  545. });
  546. </script>
  547. </body>
  548. </html>