permalink

53

Zoom-Info – How To Create An Informative Image Gallery With jQuery & CSS

Question: Have you ever wanted to neatly display a few lines of text about an image in your site but didn’t want to compromise on the design of your overall layout? In today’s post I’m going to show you how to create a useful information-rich jQuery Image Gallery that solves that problem. The best part of it is that it’s so simple to write up that all you’ll need are jQuery’s excellent .hover() and .animate() functions to get it up and running.

You can view a live MTV themed demo of what we’re going to create here or see the screenshot below.

zoominfo

(Click the image above to view full-size version)

In User-Interface design we’re always trying to push the envelope with new and interesting ways of presenting interfaces that users are used to seeing. One such interface is the traditional image gallery. You can find them pretty much everywhere..social networks, shopping, e-commerce ..even porn (not that I would ever dream of looking at anything like that!). The question is.. how do you allow a user to still get all the information they want without having to sacrifice on your UI or design?.  The answer, is by hiding that information in your interface, but keeping it accessible.

Let’s take a look at the following wirefame for today’s jQuery component.

 

image 

 

What we’re going to try achieving is having our full-size gallery image occupy the entire area of the wire-frame in our default view (“A”). What the user doesn’t know is that the image is actually contained in a div with more information about it (which you can see in the area denoted by “Header” and “Text goes here”).

When the user hovers over this image we’re going to animate/resize it to occupy the thumbnail space (“B”) you see above. This will allow the user to view all the information they want about it. They can then return back just by moving their cursor outside of the image pane.

image

Now that we know what we’re building, let’s code it up!.

HTML for the gallery:

Taylor Swift

Taylor Alison Swift (born December 13, 1989) is an American country pop singer-songwriter and actress.

Rihanna

Rihanna (born February 20, 1988) is a Barbadian R&B recording artist and model born in Saint Michael, Barbados.

Black Eyed Peas

The Black Eyed Peas is a Grammy Award winning hip hop group that formed in Los Angeles, California in 1995.

Lady Antebellum

Lady Antebellum is an American country music group formed in Nashville, Tennessee in 2006.

Lady Gaga

Lady Gaga is an American recording artist who rose to fame with her first two singles "Just Dance" and "Poker Face".

The Killers

The Killers is an American rock band from Las Vegas, Nevada, formed in 2002 who have sold over 16 million records worldwide.

CSS:

.galleryContainer
{
width: 1024px;
}
.galleryImage {
     background-color:black;
     width:325px;
     height:260px;
     overflow:hidden;
     margin:5px;
     float:left;
}
.info{
margin-left:10px;
font-family:arial;
padding:3px;
}
.info h2{
color:gray;
}
.info p {
color:white
}
.clear {
clear:both;
margin-top:10px;
}

jQuery:

$(document).ready(function()
{
	$('.galleryImage').hover(
		function()
		{
		$(this).find('img').animate(
                  { width:100,
                    marginTop:10,
                    marginLeft:10
                  }, 500);
		 },
		 function()
		 {
		  $(this).find('img').animate(
                   {width:325,
                    marginTop:0,
                    marginLeft:0
                  },300);
		 });
});

 

and that’s it!. By using jQuery’s always-useful animate() and hover() functions we’re able to define simple behaviours that shrink the size of the overall image and re-position it for more information to be visible.

 

You can now download the source files or view the demo to see what we’ve created.

 

Why do I think this is a better solution, than say, something that just moves the image completely off-screen?. Well, It’s really a question of context.

 

If you’re reading about a particular topic, no matter how short he piece of text on it is,  allowing the user to retain the context of that text (in this case the image in thumbnail form) lets them to easily remember why they hovered over it or what took their interest.

 

This is probably more important in interfaces where you’re clicking through to see more images, like a Facebook Photo Album – eg. just because that folder cover has a fun picture on it doesn’t mean the rest of it’s contents are!. Thats where a descriptive caption comes in handy and why I think this isn’t a bad idea for a user interface.

 

I hope you found this article useful!. If so, please feel free to share or leave a comment below. Thanks!

 

-Addy.

53 Comments

  1. Pingback: Zoom-Info – How To Create An Informative Image Gallery With jQuery & CSS | DesignerLinks | Home to Web design news, jQuery Tutorials, CSS tutorials, Web Designing tutorials, JavaScript tutorials and more!

  2. Man u are big!! It's nice very nice love u tuts :D I will re tweet this … do more link u on my blog. It's great more tuts from u !! ;)

    Regards
    From Poland

  3. Great demo and tutorial, thanks for posting it. I have a question though. I'm trying to implement this but the source images aren't all the same dimensions. The overflow: hidden works well for this but after hovering over and then removing the mouse the image returns to proportions for the original image and not how it appeared before the mouseover so as a result some images show part of the text underneath. Do you have any suggestions for this? Thanks again for the great tutorial.

    • Hi Mike. I'm glad to hear the tutorial was useful.

      Correct me if I've understood what you're trying to achieve, but effectively you're trying to use this effect with a set of source images that aren't all the same size and thats resulting in a few quirks with the way the animated effects work.

      What I would probably do in that case is one of a few different things. You've mentioned trying to use overflow:hidden, but how about having each of the of the images appear as the background-image property of a set of div's? This effect works best if you set a frame size for the overall image that you want to target. You can then set each of the div's to have an appropriately positioned background-image and because you're not trying to resize the differently sized images, just the same sized divs, you should be able to achieve the effect you're after.

      I hope that helps!

      • Thanks for the reply Addy. I'll give your suggestion a shot this afternoon and post back how it goes and an example if it works out. Thanks again.

  4. Pingback: Information Rich Image Gallery Using CSS & jQuery | Open Source Resources for Designers & Developers | Greepit.com

  5. You may want to add .stop() before the animate function to avoid the repeated animation when you hover the image more than 2 times :)

    <pre>
    $(this).find('img').animate
    </pre>

  6. Pingback: ITキヲスク | 2010年4/4~4/10の週間ブックマーク

  7. Pingback: Tutorial – Como crear una galería informativa con zoom de imagen con jQuery y CSS | Recursos para Diseñadores Gráficos y Web | Creativos Online

  8. Pingback: Zoom-Info, imágenes dinámicas con texto - VitaminaWEB.com

  9. Pingback: ZoomInfo: Image Gallery in jQuery & CSS

  10. Pingback: Zoom-Info – Imágenes ricas en información- Noticias del Cerebro Digital

  11. Pingback: jQuery tuts en inglés | gorkaerrea.com | diseño bilbao

  12. Pingback: Zoominfo, más información en tus imágenes

  13. Pingback: Zoom-Info – Imágenes ricas en información - slidebox

  14. Pingback: Zoom-Info – Imágenes ricas en información » Letmon.com

  15. Pingback: Zoom-Info: Informative Image Gallery Joomla Module | Magspice.com. free Icons, Colorful Wallpapers, Vector Backgrounds, Creative Fonts Typography , Wordpress Themes and Plugins, Logo Design Inspiration, Websites Showcase, Inspiration, Photography Resource

  16. Pingback: Css ve Jquery ile tasarlanmis muhtesem resim galerisi - Aciklamasi, Ingilizce, Demo, Jquery, Websitelerinizin, Ucretsiz - Paylasimin Adresi

  17. Pingback: Cool and Useful jQuery Image and Content Sliders and Slideshows - Noupe Design Blog

  18. Pingback: Cool and Useful jQuery Image and Content Sliders and Slideshows | 20 One | Designers Blog20 One | Designers Blog

  19. Pingback: Cool and Useful jQuery Image and Content Sliders and Slideshows

  20. Pingback: Sacima鲨鳍马工作室 » Blog Archive » Cool and Useful jQuery Image and Content Sliders and Slideshows

  21. Pingback: Css ve Jquery ile tasarlanmis muhtesem resim galerisi » Aciklamasi, Ingilizce, Demo, Jquery, Websitelerinizin » Paylasim Portali

  22. Pingback: 60款很酷的 jQuery 幻灯片演示和下载 | 刀侠剑客

  23. Pingback: 60款很酷的 jQuery 幻灯片演示和下载 | Artfans视觉杂志

  24. Pingback: 60款很酷的 jQuery 幻灯片演示和下载 – 峰随意动,尽从容!

  25. Pingback: 非常實用又漂亮的jQuery工具 (可免費下載喔!!) « 我是派

  26. Pingback: 59款很酷的jQuery幻灯片演示和下载 | Yovae Blog

  27. Pingback: 190+ Best! jQuery Slider tools – Part IV - Pixel2Pixel Design

  28. Pingback: 北京上升力网络科技有限公司博客 » 60款很酷的 jQuery 幻灯片演示和下载

  29. Pingback: 60款很酷的 jQuery 幻灯片演示和下载

  30. Pingback: 60款jQuery 幻灯片 | 秦唐网

  31. Pingback: 60款很酷的jQuery 幻灯片演示和下载 « Wondye's Blog

  32. Pingback: 60款很酷的 jQuery 幻灯片 | 喜乐优

Leave a Reply

Required fields are marked *.

*