Build Internet has a brand new theme, and that's only the beginning. Read the full story or hide this bar

How to Make a Threadless Style T-Shirt Gallery

How to Make a Threadless Style T-Shirt Gallery


The Basic Idea

Threadless is one of my absolute favorite t-shirt companies, so naturally I frequent their sites. One particular site (Type Tees) caught my eye with how they displayed shirts. Armed with jQuery, I went to work, while making some tweaks of my own.

Here’s the gist: There’s a thumbnail which is a full sized image in a container div, which is smaller than the full sized image. The image is centered within it, but doesn’t show entirely because overflow:hidden is turned on. When the mouse hovers over the thumbnail, overflow:hidden gets turned off, and the entire image is displayed.

Here's the gist

The caption and overlay are positioned on top of the thumbnail/image while all this is going on, disappearing when the full image is displayed from the mouse hovering on top of it. The caption is self explanatory, but the overlay in this tutorial is what rounds the bottom corners using a semi-transparent png.

Customizing It

Not everyone is looking to only display t-shirts with this method, it works equally well with standard images too. The overlay image should be the same size as your thumbnail – it serves to define the size of the link. You can use the overlay to create some neat effects, I did rounded corners, but you could do things like gradients or different corners. I’ve included the code required below, but really, you should probably just download the attached files as it’s easier to tweak from there.

The CSS

*{
 margin:0;
 padding:0;
 }
 img{
 border: none;
 }
 body {
 text-align: center;
 background: #222;
 }
 h2{
 color: #333;
 font:italic 36px Georgia, serif;
 padding: 20px;
 border-bottom: dashed 1px #999;
 clear: both;
 }
 #content{
 width: 100%;
 margin: 0px auto;
 background: #fff;
 text-align: center;
 margin-bottom: 50px;
 }
 .row{ /*Container for each row of shirts*/
 width: 495px;
 margin: 0px auto;
 clear:both;
 padding: 20px 0;
 }
 .teebox{
 overflow: hidden; /*Prevents excess of image from showing*/
 position: relative;
 margin: 0 10px;
 width: 144px; /*Width and height define thumbnail size*/
 height: 183px;
 float: left;
 clear: right;
 z-index: 0;
 }
 .selected{
 overflow: visible; /*Display part of image that not currently visible*/
 z-index: 10;
 }

 .teebox img {
 left:-84px; /*Use this to center your image when not hovered*/
 position: absolute;
 }
 .teebox a{ /*Area that changes to selected class when hovered over*/
 display:block;
 position: relative;
 float: left;
 left: 84px; /*Use to line up the overlay image*/
 z-index: 1;
 }
 .caption{
 color: #2FB5FF;
 font:14px Arial;
 position: relative;
 float: left;
 left: 0px;
 top: 146px;
 padding: 10px;
 background: #222;
 z-index: 1;
 }

The HTML

This is the HTML for a single shirt, but you could repeat the rows and shirt containers (.teebox) as needed.

<div id="content">
 <div class="row">
    <div class="teebox">
       <a href="#"><img src="overlay.png"/></a><img src="pinktee.png"/>
       <div class="caption">$10</div>
    </div>
 </div>
</div>

The jQuery

$(document).ready(function() {
 $(".teebox a").mouseover(function(){
    $(this).parent().addClass("selected");
    $(this).find('img').animate({opacity: "0.0"}, 0); //Hides overlay
    $(this).parent().find('.caption').hide(); //Hides Caption
 }).mouseout(function(){
    $(this).parent().removeClass("selected");
    $(this).find('img').animate({opacity: "1.0"}, 0); //Shows overlay
    $(this).parent().find('.caption').show(); //Shows Caption
 });
});

The Wrap Up

The primary differences between the Threadless version and my own are the jQuery and method of image hiding. My version was based on observing the frontend of their site, with some referencing of the code, which they appeared to use straight Javascript for. Additionally they made the image a background image, while I kept it as a normal img. Other than that, there are no glaring changes as far as I know.

If you’re in any way lost, check out the downloadable files, they help a bunch I swear. Any particularly pressing issues can be brought up in the comments. Keep in mind you may need to implement the PNG fix in order to make this widely compatible. Also, as a way of thanking Threadless for bringing up this wonderful idea, be sure to visit them.

Wordpress.com stats not installed! Posted Friday, June 26th, 2009 / Back to Top

I this post. Tweet
SPONSOR

49 Comments 87 Mentions

  1. BeyondRandom Author Editor

    Great tut! I have a shirt gallery site and I have been looking for a cool way to show off the shirts…will have to try this.
    .-= BeyondRandom´s last blog ..2012 (HD) Movie Trailer =-.

    June 26, 2009 · Reply

  2. Paul Author Editor

    Great tutorial.
    Nice job! Gotta love jQuery!

    June 27, 2009 · Reply

  3. Callum Chapman Author Editor

    That’s a real nice effect, love it!
    .-= Callum Chapman´s last blog ..BLOG.CALLUMCHAPMAN HAS MOVED! =-.

    June 27, 2009 · Reply

  4. 2tone Author Editor

    WOW! Very nice effect

    June 27, 2009 · Reply

  5. Music T-shirts Author Editor

    Thank you so much for this post. Really nice.

    June 28, 2009 · Reply

  6. sonichtml Author Editor

    nice effect…i live it..

    June 29, 2009 · Reply

  7. Aayush Author Editor

    great post….

    June 29, 2009 · Reply

  8. nox Author Editor

    i test in IE and safari but IE dont work :/

    June 30, 2009 · Reply

    • Sam Dunn Author Editor

      @nox I have tested/made sure it works in Firefox, Safari, and IE 7

      June 30, 2009 · Reply

  9. Mladen Author Editor

    Lovely!! Great post!!

    July 1, 2009 · Reply

  10. thekanyon Author Editor

    Great Effect! It will work on IE7+. IE6 doesn’t support png transparency so you might need to use gif files for a similar effect.

    July 1, 2009 · Reply

  11. Max Author Editor

    Problem with overlay in IE8. The overlay works fine but after mouseout the rounded corners leave a black outline. It’s not very noticeable in your demo, but I made a custom overlay and it is very noticeable, although both your overlay and my overlay work and looke fine in FF. Please let me know if there is a fix for IE8. Thanks!

    July 3, 2009 · Reply

  12. Tom Author Editor

    Hey great idea thanks for sharing this.

    July 5, 2009 · Reply

  13. elcodigodebarras Author Editor

    Thanks for this usefull resource; Long time ago I was looking for something like this, for my t shirts designs: http://www.deviantart.com/#order=9&q=elcodigodebarras+t+shirt
    .-= elcodigodebarras´s last blog ..CUT AND PASTE (Copiar y pegar) – Fuera del mundo virtual =-.

    July 9, 2009 · Reply

  14. ChattyShirts Author Editor

    Nice, thanks for sharing! This plus the GoMedia tutorial for photo realistic t-shirt mock-ups can work quite well. I also like that it uses jQuery, which makes it simpler and leaner to use with a WordPress blog.
    .-= ChattyShirts´s last blog ..Writable Thought Bubble =-.

    July 13, 2009 · Reply

  15. Bradford Sherrill Author Editor

    nice concept

    August 4, 2009 · Reply

  16. T-Shirt Printing Author Editor

    Thanks for the great tutorial – can imagine that many t-shirt web sites will start adopting this for a while

    Alex @indigo
    .-= T-Shirt Printing´s last blog ..London Calling =-.

    August 8, 2009 · Reply

  17. Liam Author Editor

    This does not require jQuery at all, could all be done with CSS.

    August 24, 2009 · Reply

  18. Sam Dunn Author Editor

    @Liam
    I am going for compatibility on this one, and the actual Threadless site makes use of Javascript to do this as well.

    August 24, 2009 · Reply

  19. Jared Roberts Author Editor

    Two Girls One Cup…. Really? LOL!

    August 24, 2009 · Reply

  20. Sander Author Editor

    @Sam Dunn

    I agree with Liam. Although the actual Threadless site uses Javascript, this could easily be done with some simple CSS. The only compatibility issue lies in the :hover at IE6. But even then a few lines of vanilla Javascript can fix that, there’s no need for a 100k jQuery solution.

    A quick mockup: http://office.react.nl/~sandervl/jquery-madness/
    .-= Sander´s last blog ..Licht aan het einde van de steeg, 22-08-2009 =-.

    August 25, 2009 · Reply

  21. Sander Author Editor

    My apologies; the link above is not accessible for the outside world. Please use http://home.react.nl/~sandervl/jquery-madness/ :)
    .-= Sander´s last blog ..Licht aan het einde van de steeg, 22-08-2009 =-.

    August 25, 2009 · Reply

  22. Sam Dunn Author Editor

    @Sander
    That is certainly a route that is becoming increasingly more doable and I am a big fan of pure CSS. I see that you have taken the inititiave to go ahead and make a page of the CSS solution, dedicated aren’t we?

    Personally I don’t view jQuery as a 100k solution as in many cases I am not loading it for the sake of doing one compatible :hover.

    August 25, 2009 · Reply

  23. jams Author Editor

    nice works guys…

    August 25, 2009 · Reply

  24. t shirt printing Author Editor

    Wow! I have been seen a lot of t shirt sites but this is one is really cool. Will definitely give this a try.
    .-= t shirt printing´s last blog ..T Shirt Printing =-.

    September 23, 2009 · Reply

  25. brian Author Editor

    really cool tutorial ,Thanks!

    June 15, 2010 · Reply

  26. Agon Author Editor

    Great tutorial…like it…

    July 1, 2010 · Reply

  27. Christen Author Editor

    How about the like button for each item coding?

    August 10, 2010 · Reply

  28. Масла Author Editor

    Very nice works guys… great tutorial

    January 1, 2011 · Reply

  29. 9ale7 Author Editor

    thanks

    April 28, 2011 · Reply

  30. perfect world Author Editor

    Wow, thats a really clever way of about it!

    June 28, 2011 · Reply

  31. mosquito killer Author Editor

    Hi, can I use your code on my wordpress blog to my gallery for my product? Thanks.

    July 19, 2011 · Reply

  32. Max Author Editor

    I tried it with Chrome and IE and the code works very well

    July 29, 2011 · Reply

  33. Rock tees Author Editor

    I’ll definetely give this a try on my website. Nice code :)

    July 29, 2011 · Reply

  34. rift platinum Author Editor

    Look like cool plugins, lots of functionalities in a single plugins. news letter plugin is a sparky one among theme. Hope i will get a chance to grab them for free

    November 2, 2011 · Reply

  35. moedas pw Author Editor

    Hi everyone, thank you for your support. The contest is closed.

    The winners are listed at the end of this article. Thank you!

    November 2, 2011 · Reply

  36. Booth Author Editor

    These clothes are very fahionable, i like them.

    February 24, 2012 · Reply

  37. Inspirational Quotes Author Editor

    How to Make a Threadless Style T-Shirt Gallery | Build Internet I was recommended this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You’re incredible! Thanks! your article about How to Make a Threadless Style T-Shirt Gallery | Build Internet Best Regards Shane Shane

    March 20, 2012 · Reply

  38. Clothes 2 Order Author Editor

    Nice tutorial guys

    March 22, 2012 · Reply

  39. attingeHect Author Editor

    Online Casino Games of [url=http://www.planet23.com/allslots-bonus-code]AllSlots Casino[/url] are have been licensed from Microgaming Software. The software is available in a download or instant play format.

    There are over 250 Casino Games in All Slots Casino. You can find: Classic Slots, Video Slots, Progessive Jackpots, Video Poker, Online Keno, Table Card Games, and more.

    March 28, 2012 · Reply

  40. Adlogo Author Editor

    Hi,

    This is fantastic advice, especially for those in the t-shirt printing. Thanks for the blog.

    October 12, 2012 · Reply

  41. Icon Printing Author Editor

    Great tutorial and very useful for those in the tshirt printing industry.

    Alex
    Icon Printing

    October 22, 2012 · Reply

  42. But Author Editor

    Find out these pointers read on and learn to know how to submit an application performing this which you policy your corporation today. alertpay

    November 1, 2012 · Reply

  43. ashburn window treatments Author Editor

    I’m pretty pleased to find this page. I wanted to thank you for ones time due to this wonderful read!! I definitely liked every little bit of it and i also have you book-marked to look at new stuff in your site.

    November 7, 2012 · Reply

  44. fredericksburg window treatments Author Editor

    I was very happy to discover this website. I wanted to thank you for ones time just for this wonderful read!! I definitely really liked every bit of it and I have you saved to fav to see new information in your website.

    November 7, 2012 · Reply

  45. cheap viagra Author Editor

    I’m very pleased to find this web site. I need to to thank you for your time for this particularly wonderful read!! I definitely liked every bit of it and i also have you book-marked to see new things on your blog.

    November 8, 2012 · Reply

  46. düğün şekeri Author Editor

    düğün şekeri

    April 4, 2013 · Reply

  47. Blanchensp Author Editor

    lifeline hospital altec lansing 251 nikon lenses philips web camera paper fan supplies psyclone cable psp music video download remington pole saw strawberry chocolate solo cup pany [url=http://www.marcjacobspurse2013.com/]マークジェイコブス アウトレット[/url]
    The Dash rosetta stone application rendering mainboard msi kenwood kdc mp332 [url=http://www.coachbagsjpsite.com/]コーチ 激安[/url]
    brother ml 300 separation anxiety in dogs rcard puma trainers for women nextbase tablet dvd [url=http://www.mcmsaihujp.com/]MCM 販売[/url]
    burr coffee mills ogre battle aluminum screen mary moo moo pamper yourself

    April 9, 2013 · Reply

  48. Woven Inc Screen Printers Author Editor

    Thanks for sharing this, I was looking for a way to display the t shirts we have printed on our website and some of this code might come in handy!

    April 25, 2013 · Reply

 

Join the Conversation

Back to Top / Comment RSS

2012 Build Internet. Created by One Mighty Roar. Icons by Komodo Media. Back to Top