"Helping businesses operate more effectively online"

19

Apr

2008

Lightbox for Images and Videos on a Joomla website
Written by Alex Ashman   

Lightbox Image JoomlaIn this tutorial we will discuss how to create a 'Lightbox' effect for your Joomla 1.0 or 1.5 website, using the plugin YOOeffects from the YOOtheme team. Using a Lightbox is a great way to show off your images on your website, as a slideshow or for individual pictures. Videos can also be shown using the Lightbox javascript - both from your own website or streamed from another site (such as YouTube).

There are a whole host of Lightbox clones available to use for your website, so choosing one can be a little daunting, especially as they all offer slightly different takes on what is essentially the same product. We have chosen to talk about one of the YOOeffects tools recently released, which is designed specifically for Joomla and is really easy to use! The script is also compressed which means loading time is quick - an important feature.

What is Lightbox?

Lightbox is a simple javascript that creates an effect that when a user clicks on the image, it pops up, is magnified using a smooth animation and is set on a darkened background. Lightbox is triggered by a 'rel' attribute in the HTML which is used in the <a> tag which surrounds the target image. The Lightbox script is great because it works on all browsers and eliminates the need for Flash animation. Flash although popular is notoriously bad for SEO as Google's bots struggle to read the data within the flash animation.

Here is an example of the lightbox working...

How to Install YOOeffects Lightbox Plugin

Installation of the plugin is very easy, once you have joined YOOtheme. Simply download the .zip file and login to the backend of Joomla as an administrator. If you are using Joomla 1.5, navigate to the 'Extensions' drop down menu, and click on 'Install/Uninstall' link shown here.

Install YOOeffects plugin

Under the 'Upload Package File' section, click on 'Browse' to find the .zip file download. Next click on 'Upload and Install'. Once this is done, the page should navigate to a new one that tells you the plugin has been enabled.

Enable the YOOeffects Plugin

Something that is quite easy to overlook, especially if you are just starting with Joomla is that even though you may have installed a plugin, Joomla does not automatically enable it - you need to do this yourself. This is a very easy process. Simply navigate to the 'Extensions' menu and select 'Plugin Manager'. If you are like us, we run a number of different plugins on GoodWebPractices - so be sure to select the 'Display # all' option at the bottom, so the plugin isn't tucked away on another page. The plugin is cunningly named 'YOOeffects', click on it.

On the left of the new page, ensure you change the status of the plugin from 'disabled' to 'enabled'. There are a number of simple parameters you can edit within the plugin too. The menu looks like this.

YOOeffects Plugin Parameters

For the purpose of this article we are solely looking at the Lightbox effect, so be sure to have this parameter on. You can find out more about the other options that are included with the YOOeffects plugin on their official page.

Lightbox effect for Images

Now that the plugin has been successfully installed, it's time to see how to write the code to ensure the plugin works for your chosen images. The code looks a little daunting, but it is really quite simple once you break it down, especially if you are used to using HTML.

The following is an image I took while travelling through Brazil. This is the Lopes Mendes beach, on Ihla Grande - paradise! If you click on the image you will see the lightbox effect.

The code should be entered into the article that you are wanting to display the image in. It is key not to copy and paste this code as text into your article, but click on the 'HTML' editor within your chosen editor then paste it.


<a href="/images/stories/lopes-mendes-beach.jpg"
title="Lopes Mendes Beach" rel="shadowbox;width=500;height=333"
alt="Lopes Mendes Beach" title="Ihla Grande" width="250" height="165" />

You will notice i have changed the title of the image for each part of the code. This is to show you that the 'Lopes Mendes Beach' is the description that appears when the lightbox is engaged, and Ihla Grande appears when you hover over the image in its present state. It can be a useful way of providing more information about your chosen image to your users.

The second part of the code determines the size of the thumbnail that is displayed to click on, be sure to keep the same proportions, to ensure the image is not distorted!

Lightbox Image Slideshow

Having slideshows of images is a clean, easy and convenient way to display images and this can be done using a Lightbox effect too. 

The code you would insert to create a slideshow of images is the following:


title="Lightbox Slideshow"rel="lightbox[group];width=500;height=333">
Click here to see a lightbox slideshow.

title="butterfly photo"rel="lightbox[group];width=500;height=333">

title="waterfall photo"rel="lightbox[group];width=333;height=500">

The best way to construct a slideshow is to add the "rel=lightbox" attribute to your links first so that they open in lightbox. Once you have done this, you need to remove the names of the links so they become invisible. The final step is to add in [group] in the rel attribute. You can name this anything you want, but all of the links must have to same name, so they appear in the same slideshow. witYou can see how i have done this in the code above. You can add in as many images as you like, and you can do this with videos too, not just images. The code is very simple, but it can be easy to make mistakes, so check through your work carefully if it does not work first time!

Display Videos using Lighbox

The great thing about this plugin is that you can use the same script to show videos on your website. It is far easier for users to focus on a video if the rest of the screen is darkened, so this plugin can be used to great effect. Importantly, this plugin means that people can watch videos hosted on other sites within your own - so there is no reason for visitors to leave you site.

The code is very similar and is as follows:

<a href="http://www.youtube.com/v/jtK6qITij5k&hl=en&autoplay=1"
title="Open Source Content Management Systems"
rel="shadowbox;width=425;height=355">Joomla and Google's Summer of Code</a>

You can play any type of video file as long as your browser can, so this tool is very useful. The key is to ensure you have the linked to the video directly - make sure you are not just linking to the page, otherwise lightbox will not play the video.

YOOtheme

Hopefully you have seen that this extension is very useful as helps to present content neatly and can keep users within your website, if linking to external files. For more help and a tutorial video please visit YOOtheme. The only downside to this plugin is that it is commercial, so you have to be a member of YOOtheme to download it, there are however different membership prices. Being a member enables you to access to all their other extensions and templates and to their professional support.

If you are looking for a free alternative, there are a number of other Lightbox extensions available for Joomla, you can find them here. In our Joomla 1.5 extensions post, we recommended High Slide, so you could give that a try.

Feel free to post your recommendations here or comments about this plugin in the comments below.

16 Comments
64
Alex A
April 29, 2008
Votes: +2

Just as an additional comment to my post - I was unaware of any free high quality lightbox effects at the time of writing.

As it happens the guys over at NinJoomla have released their lightbox for free! So if you are looking for an alternative, I would suggest you head over to their site (especially as the seem really helpful with any issues you may have)

NinJoomla Free Lightbox Plugin

You can find the official documentation on the joomla site here

Enjoy!

report abuse
vote down
vote up
0
Martino87r
May 24, 2008
Votes: +3

Thank you for this useful guide... But if i would to display an article within the Lightbox? I've tried to add the link for an article, but i view the entire website! I would to see only the article without any navbar, menu etc... It is possible to do?
Thanks Martin

report abuse
vote down
vote up
0
Martino87r
May 24, 2008
Votes: -1

Ah and if someons plan to use the YooEffects and have also a virtuemart component installed, get a lot of trouble... The fact is when you click a product image, you get 2 lightboxes !!! But there is a workaround on this page:

http://www.seongyupyoo.com/index.php?option=com_content&view=article&id=6:how-to-use-joomla-virtuemart-with-yootheme-templates&catid=13:joomla&Itemid=29

Martin

report abuse
vote down
vote up
63
David T
May 24, 2008
Votes: +0

Hi Martin! Thanks for your feedback. You can show an article in lightbox no problem... Check out the Ninja ShadowBox demo of loading webpages:

http://www.ninjoomla.com/demo/index.php?option=com_content&task=view&id=199&Itemid=69

This just shows the webpage without browser navigation etc... Is that what you want?

Thanks for the tip re: YooEffects and Virtuemart!

report abuse
vote down
vote up
0
Martino87r
May 28, 2008
Votes: +1

Hmm thanks for the link, but i really dont found the solution of my pain. I know how to use the lightbox for images,galleries etc, but i would to display only the output of an article and not the full site... I really dont know how to do it, or exactly i dont know what link i need to write inside the lightbox to retrieve only the content of an article, on the ninjoomla website there is any explanation of that smilies/sad.gif
Thanks
Martin

report abuse
vote down
vote up
0
Martino87r
May 28, 2008
Votes: +0

Ops i forgot the most important notice: the article is within my own website, so it's not an external link (Joomla 1.5).
Martin

report abuse
vote down
vote up
63
David T
May 28, 2008
Votes: +0

Hi Martin! Have you tried asking this question in the Ninjoomla forums? They might be able to help a bit more, but basically you can link using shadowbox like this:

< a rel="nofollow" rel="nofollow" href="http://www.THEPAGE.com" rel="shadowbox" class="option" title="This page" > LINK TITLE < /a >

I can't see why this wouldn't work...

report abuse
vote down
vote up
0
Martino87r
May 29, 2008
Votes: +0

Hmm, i know how to display a webpage within the lightbox... The problem is in display only the article content within the lightbox, when i try to link the article(on my site) the result is a complete page, with menu bar, navigation and other... i really don't need this. Only content of the article, nothing more. I think with a joomla link, or something else it's possible to do that, but i dont know how smilies/sad.gif
Really thanks to try for help me
Martin

report abuse
vote down
vote up
63
David T
May 29, 2008
Votes: +2

OK! So now I understand exactly what you want! Actually there is a way to do sort of do that - you could simply link to the "print" page that Joomla can generate.

Rather than linking to the page itself, use this address:

http://www.YOURSITE.com/index2.php?option=com_content&task=view&id=XX

Obviously you need to replace XX with the article ID number.

Does that work for you now then?

You should add a rel=nofollow" to the link so that search engines don't crawl and index the print page (for duplicate content reasons).

report abuse
vote down
vote up
0
esma
August 01, 2008
Votes: +0

hi i want to know
how to create a gallery with next and previous buttons on the lightbox???


regards

report abuse
vote down
vote up
0
Fire
August 17, 2008
Votes: +1

Hi there, is it possible to put other things in a lightbox - say a contact us form? I am looking for a contact form that appears in a lightbox... any ideas?

report abuse
vote down
vote up
63
David Towers
August 18, 2008
Votes: +0

Thanks for posting!

@Esma, you should try HighSlide for Joomla http://www.solariz.de/hs4joomla for doing galleries...

@Fire, Yes that is possible. With Ninja ShadowBox, you can load webpages:

http://www.ninjoomla.com/demo/index.php?option=com_content&task=view&id=199&Itemid=69

So basically you could use this to show a contact form in the shadow box... Is that helpful?

report abuse
vote down
vote up
0
shae
October 02, 2008
Votes: +0

Hola! how do you add the nifty png frames to your thumbnails? know what I mean?

report abuse
vote down
vote up
0
Alec
November 12, 2008
Votes: +0

Hi,

I really enjoyed your tutorial. Thank you for taking the time to post it. I have one question. I did what you said for pictures and it works perfectly in my Joomla 1.5 site. However, when I replace my main menu with a flash menu module, the lightbox effect no longer works. Instead, it just opens to a new page without the lightbox. Any thoughts on why this would occur?

Thank you for your tutorial, once again!
Alec

report abuse
vote down
vote up
0
sarita
February 13, 2009
Votes: +0

Hi,

I´ve al ready knew how to post a lightbox, what was so interesting about yours is that it does not need to put grey all my information, I really like yours, what´s the diference?

thanks!!

report abuse
vote down
vote up
0
Edda
May 04, 2009
Votes: +0

Hello,
Has anyone used YOOeffect lightbox with image mapping?

report abuse
vote down
vote up

Write comment
 
  smaller | bigger
 

busy