Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 102 lines (82 sloc) 5.685 kb
<!doctype html>
<html>
<head>
<title>jQuery Lightbox | Test Page</title>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script src="jquery.lightbox.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
base_url = document.location.href.substring(0, document.location.href.indexOf('index.html'), 0);
$(".lightbox").lightbox({
fitToScreen: true,
imageClickClose: false
});
$(".lightbox-2").lightbox({
fitToScreen: true,
scaleImages: true,
xScale: 1.2,
yScale: 1.2,
displayDownloadLink: true
});
$(".lightbox-json").lightbox({
fitToScreen: true,
jsonData: new Array(
{url: base_url + 'images/image-0.jpg', title: 'Image 1 loaded using JSON data' },
{url: base_url + 'images/image-1.jpg', title: 'Image 2 loaded using JSON data' },
{url: base_url + 'images/image-2.jpg', title: 'Image 3 loaded using JSON data' },
{url: base_url + 'images/image-3.jpg', title: 'Image 4 loaded using JSON data' }
),
loopImages: true,
imageClickClose: false,
disableNavbarLinks: true
});
});
</script>
<style type="text/css">
body{ color: #333; font: 13px 'Lucida Grande', Verdana, sans-serif; }
</style>
</head>
<body>
<h1><a href="http://krewenki.github.com/jquery-lightbox">jQuery Lightbox <em>v0.9</em></a></h1>
<p>Modified work by <a href="http://krewenki.github.com/">Warren Krewenki</a></p>
<p>Originally written by <a href="http://www.huddletogether.com">Lokesh Dhakar</a></p>
<h2>Example 1: Single Image</h2>
<a href="http://farm2.static.flickr.com/1257/1092054504_0857149719_d.jpg" class="lightbox" title="Photo by Warren Krewenki"><img src="http://farm2.static.flickr.com/1257/1092054504_0857149719_t_d.jpg" height="40" alt="" /></a>
<h2>Example 2: Series</h2>
<a href="http://farm2.static.flickr.com/1036/1092054380_6040129664_d.jpg" class="lightbox-2" rel="flowers" title="Photo by Warren Krewenki"><img src="http://farm2.static.flickr.com/1036/1092054380_6040129664_t_d.jpg" height="40" alt="" /></a>
<a href="http://farm2.static.flickr.com/1257/1092054504_0857149719_d.jpg" class="lightbox-2" rel="flowers" title="Photo by Warren Krewenki"><img src="http://farm2.static.flickr.com/1257/1092054504_0857149719_t_d.jpg" height="40" alt="" /></a>
<a href="http://farm4.static.flickr.com/3130/2901336771_ecb32f7462_b_d.jpg" class="lightbox-2" rel="flowers" title="Photo by Warren Krewenki"><img src="http://farm4.static.flickr.com/3130/2901336771_ecb32f7462_t_d.jpg" height="40" alt="" /></a>
<a href="http://farm4.static.flickr.com/3487/3294395073_55c3e7583e_o_d.jpg" class="lightbox-2" rel="flowers" title="Bedford Basin by Warren Krewenki"><img src="http://farm4.static.flickr.com/3487/3294395073_1051c3daa1_t_d.jpg" height="40" alt="" /></a>
<h2>Example 3: Images loaded using jsonData parameter (thumbnails are static)</h2>
<a href="http://farm4.static.flickr.com/3130/2901336771_ecb32f7462_b_d.jpg" class="lightbox-json" title="Photo by Warren Krewenki"><img src="http://farm4.static.flickr.com/3130/2901336771_ecb32f7462_t_d.jpg" height="40" alt="" /></a>
<a href="http://farm4.static.flickr.com/3487/3294395073_55c3e7583e_o_d.jpg" class="lightbox-json" title="Photo by Warren Krewenki"><img src="http://farm4.static.flickr.com/3487/3294395073_1051c3daa1_t_d.jpg" height="40" alt="" /></a>
<h2>How to Use:</h2>
<h3>Part 1 - Setup</h3>
<ol>
<li>jQuery lightbox v0.5 uses the jQuery Library. You will need to include these two Javascript files in your header.
<pre><code>&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;lightbox.js&quot;&gt;&lt;/script&gt;
</code></pre>
</li>
<li>Include the Lightbox CSS file (or append your active stylesheet with the Lightbox styles).
<pre><code>&lt;link rel=&quot;stylesheet&quot; href=&quot;css/lightbox.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
</code></pre>
</li>
<li>Check the CSS and make sure the referenced <code>prevlabel.gif</code> and <code>nextlabel.gif</code> files are in the right location. Also, make sure the <code>loading.gif</code> and <code>closelabel.gif</code> files as referenced near the top of the <code>lightbox.js</code> file are in the right location.</li>
</ol>
<h3>Part 2 - Activate</h3>
<ol>
<li>Add a <code>class="lightbox"</code> attribute to any link tag to activate the lightbox. For example:
<pre><code>&lt;a href=&quot;images/image-1.jpg&quot; class=&quot;lightbox&quot; title=&quot;my caption&quot;&gt;image #1&lt;/a&gt;
</code></pre>
<em>Optional: </em>Use the <code>title</code> attribute if you want to show a caption. </li>
<li>If you have a set of related images that you would like to group, follow step one but additionally include a group name in the rel attribute. For example:
<pre><code>&lt;a href=&quot;images/image-1.jpg&quot; class=&quot;lightbox&quot; rel=&quot;roadtrip&quot;&gt;image #1&lt;/a&gt;
&lt;a href=&quot;images/image-2.jpg&quot; class=&quot;lightbox&quot; rel=&quot;roadtrip&quot;&gt;image #2&lt;/a&gt;
&lt;a href=&quot;images/image-3.jpg&quot; class=&quot;lightbox&quot; rel=&quot;roadtrip&quot;&gt;image #3&lt;/a&gt;
</code></pre>
No limits to the number of image sets per page or how many images are allowed in each set. Go nuts!</li>
</ol>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.