Lightview was built to change the way you overlay content on a website.
Upload all files from the lightview library to your server: javascript, css and the images.
Download Prototype 1.6.0.2 and Scriptaculous 1.8.1 and upload the files from these libraries as well. When that's done, refer to the required files in your header as in the example below.
The correct order of the files is as in the example, make sure you follow it. Even though effects.js is not in the list below, scriptaculous will dynamically include it, so make sure to upload it as well.
<link rel="stylesheet" type="text/css" href="css/lightview.css" /> <script type='text/javascript' src='js/prototype.js'></script> <script type='text/javascript' src='js/scriptaculous.js?load=effects'></script> <script type='text/javascript' src='js/lightview.js'></script>
If you want to make the filesize smaller, have a look at Protopacked. It contains compressed versions of Prototype and Scriptaculous. You can have the required files, Prototype and effects.js, starting at 28kb.
A view is created using a links class attribute. Single images should have the rel attribute set to 'image', but you can also use no rel attribute at all.
<a href='image.jpg' class='lightview'>My image</a>
An image gallery can be created using rel='gallery[setname]'
<a href='image1.jpg' class='lightview' rel='gallery[myset]'>Image 1</a> <a href='image2.jpg' class='lightview' rel='gallery[myset]'>Image 2</a>
You can set the title and caption using the title attribute. Use the characters '::' if you want both title and caption. The character combination can be changed using the titleSplit option.
<a href='leopard.jpg' title='A title' class='lightview' >Leopard</a> <a href='gazelle.jpg' title='This image has a title :: And a caption' class='lightview'>Gazelle</a> <a href='cheetah.jpg' title=":: I don't have a title, just a caption" class='lightview'>Cheetah</a> <a href='rhino.jpg' title="Left in split characters will get stripped :: " class='lightview'>Rhino</a>
Other media accepts a thirth parameter for options.
<a href='http://www.google.com' rel='iframe' title='Google :: :: fullscreen: true' class='lightview' >Google</a> <a href='http://www.yahoo.com' rel='iframe' title='Yahoo :: A caption :: width: 800, height: 600' class='lightview' >Yahoo</a>
You can create inline content views by adding #id to the href. As options you can use autosize on ajax and inline content, this will automatically resize the view to the content recieved. topclose can be used on ajax, iframe and inline content to have the close button that slides out instead of the static one.
<a href='#hiddenform' class='lightview' title=' :: :: topclose: true, autosize: true' >Show Form</a>
<a href='/ajax/' rel='ajax' title=' :: :: ajax: { onComplete: callback }' >Ajax Form</a>
<a href='#anotherElement' class='lightview' title=' :: :: menubar: false' >No menubar</a>
It's possible to show a view using an object:
Lightview.show({
href: '/ajax/',
rel: 'ajax',
title: 'Login',
caption: 'Enter your username and password to login',
options: {
autosize: true,
topclose: true,
ajax: {
method: 'get',
onComplete: function(){ $('name').focus(); }
}
}
});
// If you have firebug installed you can run this from your console, have fun.
Lightview.show({ href: 'http://www.google.com', rel: 'iframe', options: { width: 800, height: 500 }});
The type of view will be auto-detected using the url you provide. If for some reason you want to force a specific type of view you can overwrite the auto-detection using the rel attribute.
Lightview.show({
href: 'http://movies.apple.com/movies/newline/semi_pro/semi_pro-tlr1_h.480.mov',
rel: 'quicktime' // not required
});
Configuration options:
You can set the following in lightview.js
Forcing media type using 'rel'
You can overwrite the auto detection of the media type. This is useful when Lightview is not detecting your media. For example, when including Youtube or Google video through Flash. The following types are supported using the the rel attribute. For example rel='flash'.
Element options:
These options can be used as thirth parameters in the title attribute, seperated by commas. title='title :: caption :: autosize: true, topclose: true'
Functions:
The following function are available when using Lightview.
Custom Events:
You can observe the document or individual links for this event. A function can be called when the event fires. Within the function, event.target will refer to the element that was opened, a few examples:
document.observe('lightview:opened', function(event) {
alert('You opened ' + event.target.href);
});
$('myId').observe('lightview:opened', function(event) {
new Effect.Pulsate($('lightview').down('.title'));
});
Keyboard:
Permission to use Lightview on your domain is required and can be obtained by paying a small fee. For non-commercial domains this will allow you to use Lightview under a Creative Commons Attribution-Noncommercial-No Derivative Works License. When you get permission for a commercial domain you may use Lightview under the terms of the Creative Commons Attribution-No Derivative Works License.
Note: When updating make sure to replace all files.
Toggle all changelog entries
*2.2.7 - 2.2.8* (May 03-05, 2008) * Made it possible to disable the keyboard buttons [donwilson] * No more wmode transparent on flash to preserve background colors [xylef] * Fixed console warning from 2.2.7 [mlbfan86]
Use the Lightview Forum for support related questions, feedback, feature requests and bug reports. If you are posting for support please read through the Troubleshooting section first.
For anything non-support related you can contact me at nick@nickstakenburg.com. Please use the forum to get support.