How to add Lightbox effect to Blogger

Lightbox is a simple, unobtrusive script used to overlay images on the current page. The Lightbox effect is useful when your post has many images or images with large sizes, it helps people to save time browsing images in an impressive way. We’ll see how to add Lightbox effect to Blogger (blogspot) blogs.

lightbox How to add Lightbox effect to Blogger

We are going to use the jQuery Lightbox plugin for Blogger. And before going into detail, you might want to see Lightbox in action (click on the image above to enlarge).

How to install

Login to Blogger Dashboard, go to Design, Edit HTML:

Image%2B1 How to add Lightbox effect to Blogger

Add the following code right before the </head> tag:

<link href="http://rilwis.googlecode.com/svn/trunk/blogger/lightbox.css" media="screen" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script src="http://rilwis.googlecode.com/svn/trunk/blogger/lightbox.min.js" type="text/javascript"></script>

Image%2B2 How to add Lightbox effect to Blogger

This will add the CSS and JS files into your template. These files are hosted in my Google Code project, but you can download them (with links above) and save into your favorite host.

How to use

Once you’ve done the installation, whenever you want to add Lightbox effect, switch editor mode to HTML, and wrap the image IMG tag inside a A tag as the following code:

<a href="url of the full-size image"><img src="url of the thumbnail" /></a>

Image%2B4 How to add Lightbox effect to Blogger

Using Lightbox in blog posts is a good way to keep visitors not browsing to other pages for just viewing images. One of other advantages of using Lightbox is that you can use thumbnails in post content instead of full-size images, that reduces total size of page, thus reduces page loading time.


About Tran Ngoc Tuan Anh

Also known as Rilwis. A web, WordPress developer. Freelance. Founder of Deluxe Blog Tips and Look4WP. Loves books, Internet & technology.

Comments

  1. Anonymous says:

    Are there any way to apple this trick all image in blog? Adding this code one by one horrible.

  2. nadia kamel says:

    hello, this was good but i followed what you said exactly. the photo i added to my blog opens in another page not in a nice lightbox as i expect. this photo was uploaded from my computer . i am using the simple template and firefox browser .would you please help me?

  3. Hello i have a problem with lightbox. i have script(http://java-templates.googlecode.com/files/jquery-1.4.3.min.js) on my blogger. I used that script for my navigation drop down menu. if i will remove that script, lightbox will work, but my menu will not. vice versa.. do i need to sacrifice one ? or there is a solution ?

  4. Abid khan says:

    Hey I have the same problem as Manuel Garcia PH said. Can you please provide us a solution or we have to go for another lightbox?
    Thankx

    • rilwis says:

      Maybe the problem comes from conflict between the Lightbox script and script for menu. But as the Lightbox is popular,so I think there’re maybe some problems with the menu script. I’m not sure, but you can use Firebug to debug the JS.

  5. Nice article!!!!!

  6. Blogger has added Lightbox feature into its system. Refer this link on how to enable it. No programming or code needed.
    http://www.custombloggertemplate.com/2011/10/blogger-lightbox-is-back-this-time-with.html

  7. Joanna says:

    It works fine in the main page but why doesn’t it work on individual item pages?

  8. Great ! It works. Thank you ^_^

  9. Dexter says:

    thanks for sharing this post! but I didn’t understand that how to add lightbox effect in images. please explain a bit.
    Thanks

  10. Abliukh says:

    Thanks for Post….

  11. Desta says:

    Working on my blog, thank you.

Speak Your Mind

*