Create an Image Rotator with Description (CSS/jQuery)

By Soh Tanaka | Published May 4th, 2009 in Tutorials

An image rotator is one great way to display portfolio pieces, eCommerce product images, or even as an image gallery. Although there are many great plugins already, this tutorial will help you understand how the image rotator works and helps you create your own from scratch.

Creating an Image Rotator

View Demo of Image Rotator

Image Rotator - CSS jQuery

Step1. HTML – Image Rotator Wireframe

Start by building the html wireframe of the layout. As you can see in the image below, there will be two major sections (the main image section and the thumbnail list section). In addition to the sections for images, the third section, labeled “desc”, will contain the main_image description.

Image Rotator - CSS jQuery

main_image Section HTML

<div class="main_image">
    <img src="banner1.jpg" alt="" />
    <div class="desc">
        <a href="#" class="collapse">Close Me!</a>
        <div class="block">
            <h2>Title</h2>
            <small>Date</small>
            <p>Copy</p>
        </div>
    </div>
</div>

image_thumb Section HTML
Note – The thumbnail list section will be very similar in markup as the main image section, but each will all be encapsulated in its own list item.

<div class="image_thumb">
    <ul>
        <li>
            <a href="banner1.jpg"><img src="banner1_thumb.jpg" alt="Image Name" /></a>
            <div class="block">
                <h2>Title</h2>
                <small>Date</small>
                <p>Copy</p>
            </div>
        </li>
    </ul>
</div>

Step 2. CSS – Image Rotator Wireframe

Next, it’s time to style the image rotator’s HTML wireframe with CSS.

main_image section CSS

.main_image {
    width: 598px;
    height: 456px;
    float: left;
    background: #333;
    position: relative;
    overflow: hidden; /*--Overflow hidden allows the description to toggle/tuck away as it slides down--*/
    color: #fff;
}
.main_image h2 {
    font-size: 2em;
    font-weight: normal;
    margin: 0 0 5px;
    padding: 10px;
}
.main_image p {
    font-size: 1.2em;
    line-height: 1.6em;
    padding: 10px;
    margin: 0;
}
.block small { /*--We'll be using this same style on our thumbnail list--*/
    font-size: 1em;
    padding: 0 0 0 20px;
    background: url(icon_calendar.gif) no-repeat 0 center;
}
.main_image .block small {margin-left: 10px;}
.main_image .desc{
    position: absolute;
    bottom: 0;
    left: 0; /*--Stick the desc class to the bottom of our main image container--*/
    width: 100%;
    display: none; /*--Hide description by default, if js is enabled, we will show this--*/
}
.main_image .block{
    width: 100%;
    background: #111;
    border-top: 1px solid #000;
}
.main_image a.collapse { /*--This is our hide/show tab--*/
    background: url(btn_collapse.gif) no-repeat left top;
    height: 27px;
    width: 93px;
    text-indent: -99999px;
    position: absolute;
    top: -27px;
    right: 20px;
}
.main_image a.show {background-position: left bottom;}

image_thumb section CSS

.image_thumb {
    float: left;
    width: 299px;
    background: #f0f0f0;
    border-right: 1px solid #fff;
    border-top: 1px solid #ccc;
}
.image_thumb img {
    border: 1px solid #ccc;
    padding: 5px;
    background: #fff;
    float: left;
}
.image_thumb ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.image_thumb ul li{
    margin: 0;
    padding: 12px 10px;
    background: #f0f0f0 url(nav_a.gif) repeat-x;
    width: 279px;
    float: left;
    border-bottom: 1px solid #ccc;
    border-top: 1px solid #fff;
    border-right: 1px solid #ccc;
}
.image_thumb ul li.hover { /*--Hover State--*/
    background: #ddd;
    cursor: pointer;
}
.image_thumb ul li.active { /*--Active State--*/
    background: #fff;
    cursor: default;
}
html .image_thumb ul li h2 {
    font-size: 1.5em;
    margin: 5px 0;
    padding: 0;
}
.image_thumb ul li .block {
    float: left;
    margin-left: 10px;
    padding: 0;
    width: 170px;
}
.image_thumb ul li p{display: none;}/*--Hide the description on the list items--*/

Step3. jQuery – Image Rotation Effect

If you are new to jQuery or have not had much experience with it, first go over the basics.

Show Image Description and Set Transparency on Block
To degrade gracefully, the image banner description is set to be hidden at default with CSS (refer to the “.main_image .desc” class in the CSS). We will show the image description if JavaScript is enabled.

$(".main_image .desc").show(); //Show Banner
$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity

Click and Hover Events for Image List
The following script will change the main_image when a list-item in the image_thumb is clicked. Each line also contains a comment explaining which jQuery actions are being performed.

$(".image_thumb ul li:first").addClass('active'); //Add the active class (highlights the very first list item by default)
$(".image_thumb ul li").click(function(){
    //Set Variables
    var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
    var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
    var imgDesc = $(this).find('.block').html();  //Get HTML of the "block" container
    var imgDescHeight = $(".main_image").find('.block').height(); //Find the height of the "block"

    if ($(this).is(".active")) {  //If the list item is active/selected, then...
        return false; // Don't click through - Prevents repetitive animations on active/selected list-item
    } else { //If not active then...
        //Animate the Description
        $(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() { //Pull the block down (negative bottom margin of its own height)
            $(".main_image .block").html(imgDesc).animate({ opacity: 0.85,  marginBottom: "0" }, 250 ); //swap the html of the block, then pull the block container back up and set opacity
            $(".main_image img").attr({ src: imgTitle , alt: imgAlt}); //Switch the main image (URL + alt tag)
        });
    }
    //Show active list-item
    $(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all list-items
    $(this).addClass('active');  //Add class of 'active' on the selected list
    return false;

}) .hover(function(){ //Hover effects on list-item
    $(this).addClass('hover'); //Add class "hover" on hover
    }, function() {
    $(this).removeClass('hover'); //Remove class "hover" on hover out
});

Toggle the Hide/Show Option
This is fairly simple. On each click, either show or hide the description.

$("a.collapse").click(function(){
    $(".main_banner .block").slideToggle(); //Toggle the description (slide up and down)
    $("a.collapse").toggleClass("show"); //Toggle the class name of "show" (the hide/show tab)
});

View Demo of Image Rotator

Image Rotator - CSS jQuery

Conclusion

Do keep in mind these jQuery driven image rotators do not degrade in the best fashion. As you can see, when you disable JavaScript, each thumbnail must be clicked on to get the larger image (which opens in the same window). But for those who have a user base with JavaScript enabled, you are in the clear and it can be used and customized to fit various scenarios.

Experiment and customize this to fit your needs. If you have any questions, concerns, suggestions, or comments, please do not hesitate to let me know.

Credits: Much appreciation to Glenn Jones for allowing me to use his beautiful illustrations for the example images.

About the Author:

Soh Tanaka is a Los Angeles based Web Designer and blogger, who recently launched a CSS Web Gallery called Design Bombs. For more front-end web development tutorials, check out his web design blog or you can follow him on twitter @SohTanaka


408 Comments
  1. demogar on May 5th, 2009

    Really great tut. Thanks for this one!

  2. vocal on May 5th, 2009

    very good tut, and it’s clearly and useful, thanks.

    and for advance effect, I think you can add some animation effect for the big images, such as fade, slidedown,and so on.

  3. Ariyo on May 5th, 2009

    Great tut and excellent idea. I’m so making this. Thanx!

  4. popurls.com // popular today…

    story has entered the popular today section on popurls.com…

  5. alex on May 5th, 2009

    Nice tut I have sth to share too. I think people would like to know integrate feature article content slide show into wordpress

  6. cat3y3 on May 5th, 2009

    How can you rotate this automatically? (After 5 second, the next item)?

    Great tutorial. I like the clean and usable design.

  7. HieuUk on May 5th, 2009

    Good effect, I would suggest to use it with my ImageSwitch to create a better transaction effect. Also, if you don’t use that plugin, you should integrate some kind of preload or loading effect.

  8. izzat aziz on May 5th, 2009

    nice tutorial. pretty useful especially for my latest project. but one think though, when click into the text instead of picture it will only change the description but picture remain the same. It not much of problem since it can be alter right?

    thank for tutorial. :D

  9. izzat aziz on May 5th, 2009

    sorry. it the picture actually change too but a lil bit late compare to description. sorry about that.

  10. Steven Snell on May 5th, 2009

    Izzat,
    On my connection the image changes immediately after the description. But on a slower connection there may be a little delay.

  11. Mike on May 5th, 2009

    Nice little tutorial.
    As has already been pointed out, there is quite a time lag between the text changing and the image changing. But once the images have been cached, ie. the second time around, it’s fine.
    Perhaps it might help to preload the images.

  12. Len on May 5th, 2009

    Really nice effect and implementation. Re: the lag between text and image loading — I have that problem too. Is there a way to preload all images via jQuery? That’d really make this sing. Ld

  13. Archane on May 5th, 2009

    Great article, I’ll be incorporating this in to a business site I’m developing!

  14. [...] Source: Create an Image Rotator with Description (CSS/jQuery). [...]

  15. izzat aziz on May 5th, 2009

    Steven Snell,

    thank for telling me. so its my connection speed the real problem is.

  16. mark on May 5th, 2009

    This is awesome, could do with speeding the image transition up slightly. Good to see a tut clearly labelled too :-)

  17. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  18. [...] Create an Image Rotator with Description (CSS/jQuery) An image rotator is one great way to display portfolio pieces, eCommerce product images, or even as an image gallery. Although there are many great plugins already, this tutorial will help you understand how the image rotator works and helps you create your own from scratch. [...]

  19. roni on May 5th, 2009

    @steve @izzat
    Probably because image swaps before text.
    May be add somewhere, before swap text=”" onFinish=changeText, could that be possible ?

    So that the text only displays when image is actually loaded ?

    I honestly have no idea of the feasability of such idea. :)

    BTW.. ppl… click on the ads !!

    Thanks.
    Keep on the good content.

    PS:
    I am more into prototypeJS (for client’s reasons) but I am thinking about moving to JQuery, and I feel your tut is really well written. A real tut !! Step by step. Even if, I must admit I only “scanned” the whole content.
    Nevertheless, I bounced from cssglobe… but I will, for sure, come back !
    I shall, if time pops up, ty to come up with same efffect on prototype. ;)

  20. Rahul on May 5th, 2009

    Cool tutorial, just what I needed for the this time. ;)

  21. [...] Create an Image Rotator with Description (CSS/jQuery) (tags: jquery slideshow tutorial css webdesign image javascript portfolio rotator) [...]

  22. Kai Chan Vong on May 5th, 2009

    Hey, great tutorial. One suggestion would be to use a CSS-Sprite so that all the images load up together and then you wouldn’t see any delay varying from the user’s bandwidth capabilities.

    Keep up the good work!

  23. [...] Create an Image Rotator with Description (CSS/jQuery) (tags: jquery tutorial) [...]

  24. [...] is another great free resource courtesy of designm.ag. This article gives you are great insight into how to make an image rotator using simple CSS and a [...]

  25. [...] product images, or even as an image gallery. DesignMag has published a tutorial teaching us how to Create an Image Rotator with jQuery and CSS. It will help you understand how the image rotator works and helps you create your own from [...]

  26. [...] Create an Image Rotator with Description – a tutorial on how to create an image rotator with jQuery and CSS. [...]

  27. insic on May 7th, 2009

    looks nice. perfect to integrate for wordpress theme.

  28. Gabriel Paiva on May 7th, 2009

    Hello,

    Just GREAT ! Thanks !

    Is there a way to make the pictures to change after 10 seconds ? So the user does not have to click in teh link …

    Thanks in advance

  29. Soh Tanaka on May 8th, 2009

    Thanks to all who commented and gave back some constructive feed back :-)

    For those who would like to fade the image in and out you can add 2 more lines of code like so:

    $(".main_image img").animate({ opacity: 0}, 250 );
    $(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 250 );
    $(".main_image img").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
    });

    As for the automated rotations, I would check out this tutorial for an idea: http://jonraasch.com/blog/a-simple-jquery-slideshow

    I will try to include these kind of solutions on my next tutorial as an option :-) Thanks again~

  30. Soh Tanaka on May 8th, 2009

    Here is the live demo for what i was talking about above: http://www.sohtanaka.com/web-design/examples/image-rotator/index2.htm

  31. Steven Snell on May 8th, 2009

    Hey Soh,
    Thanks for adding that link, looks pretty cool. Great tutorial as always.

  32. Steven Snell on May 9th, 2009

    Hi Mauricio,
    Soh had some difficulty with his web host. It seems to be fine now.

  33. Robin on May 10th, 2009

    Just what i was looking for!! Except I really needed the automated rotation :(

    Looking forward to the next version.

  34. Fred75 on May 11th, 2009

    Me too, I wait for the next version, with automated rotation and maybe fadin

  35. Markus Koljonen on May 11th, 2009

    Awesome!

    What about Flickr? How would you use this to display the latest from items your photo stream?

  36. [...] Create an Image Rotator with Description (CSS/jQuery) (tags: javascript gallery jquery webdesign) [...]

  37. cjbates on May 13th, 2009

    Nice tutorial, very clean looking interface. One thing you might want to add is a simple “return false;” in the toggle hide/show option. This will keep the page from following the link to “#” and scrolling up to the top when the collapse button is clicked.

    $(“a.collapse”).click(function(){
    $(“.main_banner .block”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    return false;
    });

  38. mblack on May 13th, 2009

    This plugin is really fantastic, but there’s one thing I can’t seem to figure out how to do. I’m trying to have the picture change by clicking a text link instead of the thumbnail image. Every jquery plugin I’ve found so far uses thumbs as the base point for the image swap.

    To be more specific, I’d want the image to change by clicking on the title of the piece (ex. Slowing Down) and having that change the image and getting rid of the thumb all together.

    Any way to do this?

  39. [...] product images, or even as an image gallery. DesignMag has published a tutorial teaching us how to Create an Image Rotator with jQuery and CSS. It will help you understand how the image rotator works and helps you create your own from [...]

  40. EthanJ on May 14th, 2009

    Great tut. Unlike 90% of rotators it degrades really nicely. Very easily skinable and hackable. 10/10. Thank you.

  41. Tonyk on May 14th, 2009

    It would be great if the list on the left had an up/down slider so you could have like 20 entries in the list and move up/down without extending the page length.

    Great tutorial!

  42. [...] Create an Image Rotator with CSS/jQuery [...]

  43. Soh Tanaka on May 16th, 2009

    @cjbates Great point! I was hoping no one would catch that :-p I noticed that as well after I had already submitted the article. Good catch!

    @mblack The thumbnail can just be taken out since jQuery is targeting the list item as a whole. If you want it to degrade well w/out the thumbnail, you can just link the text instead of the thumbnail :-)

  44. randy johnson on May 18th, 2009

    Is there a way to download all of the files at once? Or can one just use the demo site? I can’t seem to find usage info, for our small family website.

  45. Lochlan on May 19th, 2009

    I’ve made it so it rotates automatically, using the fade effect mentioned above and will also respond to click events. I’m sure there’s nicer ways to do this, but here’s what I’ve done:

    jQuery(function(){

    $(“.main_image .desc”).show(); //Show Banner
    $(“.main_image .block”).animate({ opacity: 0.65 }, 1 ); //Set Opacity
    $(“.image_thumb ul li:first”).addClass(‘active’); //Add the active class (highlights the very first list item by default)

    //runs function on click
    $(“.image_thumb ul li”).click(function () {
    $active = $(this);
    slideSwitchClick();
    })
    .hover(function(){ //Hover effects on list-item
    $(this).addClass(‘hover’); //Add class “hover” on hover
    }, function() {
    $(this).removeClass(‘hover’); //Remove class “hover” on hover out
    });

    //runs function, set timer here
    $(function() {
    setInterval( ’slideSwitchTimed()’, 6000 );
    });

    });

    function slideSwitchTimed() {
    $active = $(‘.image_thumb ul li.active’).next();
    if ( $active.length == 0 ) $active = $(‘.image_thumb ul li:first’); //goes back to start when finishes
    slideSwitch();
    }

    function slideSwitchClick() {
    slideSwitch();
    }

    function slideSwitch() {
    var $prev = $(‘.image_thumb ul li.active’);

    //Show active list-item
    $prev.removeClass(‘active’);
    $active.addClass(‘active’);

    //Set Variables
    var imgAlt = $active.find(‘img’).attr(“alt”); //Get Alt Tag of Image
    var imgTitle = $active.find(‘a’).attr(“href”); //Get Main Image URL
    var imgDesc = $active.find(‘.block’).html(); //Get HTML of the “block” container
    var imgDescHeight = $(“.main_image”).find(‘.block’).height(); //Find the height of the “block”

    if ($(this).is(“.active”)) { //If the list item is active/selected, then…
    return false; // Don’t click through – Prevents repetitive animations on active/selected list-item
    } else { //If not active then…
    //Animate the Description
    $(“.main_image img”).animate({ opacity: 0}, 250 );
    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
    });
    }
    return false;
    }

  46. Robin on May 19th, 2009

    Nice one Lochlan!

    Is there anyway of stopping it rotating if the user clicks one of the options? Because at the moment it will suddenly switch if the user selects something and it’s close to rotation time.

  47. Mo on May 19th, 2009

    I can’t see the demo working either. any advice?

  48. Lochlan on May 19th, 2009

    Hey Robin,

    Sure, replace:

    //runs function, set timer here
    $(function() {
    setInterval( ’slideSwitchTimed()’, 6000 );
    });

    with:
    //pauses on hover
    $(‘.highlight’).hover(function() {
    clearInterval(playSlideshow);
    },
    function() {
    playSlideshow = setInterval( “slideSwitchTimed()”, 6000 );
    });

    Just change ‘.highlight’ to whatever element you want to cause the animation to pause when the user hovers their mouse over.

  49. Lochlan on May 19th, 2009

    Sorry, I forgot a bit, replace with:

    //runs function, set timer here
    $(function() {
    //setInterval( ’slideSwitchTimed()’, 6000 );
    playSlideshow = setInterval( “slideSwitchTimed()”, 6000 );
    });

    //pauses on hover
    $(‘.highlight’).hover(function() {
    clearInterval(playSlideshow);
    },
    function() {
    playSlideshow = setInterval( “slideSwitchTimed()”, 6000 );
    });

  50. Nick Sumpter on May 20th, 2009

    I have used this tutorial as the basis for the ‘front page redesign’ of our companies site. I have altered the code so that the ‘thumbs’ are in the same box as the ‘main image’ and therefore you can do all kinds of fancy layering effects using transparency. Working example is under development at http://www.envogen.co.uk and the code should be visible if you want it.

    Anyone with design suggestions please get in touch because I am by no means a professional web designer :-)

    Thanks again Soh, the tutorial was superb.

  51. [...] hours of searching around I found an amazing tutorial by Soh Tanaka on Design M.ag called “Create an Image Rotator“. If you follow the link you’ll see a nice simple tutorial on making a great looking [...]

  52. Ryan on May 21st, 2009

    This is a great tool to implement onto a site. One thing I think is missing is ‘paging (Next, Previous)’. I am working on putting it together, once it is complete I will post it for you guys.

  53. BenHen on May 21st, 2009

    Nick Sumpter, your script does work with google chrome ;)

  54. BenHen on May 21st, 2009

    Sorry, it’s work now, it was my conputer :$

  55. Colows on May 22nd, 2009

    no zip files?

  56. carl on May 22nd, 2009

    Hi -
    I like this jquery feature alot! Thanks.
    One problem I can’t figure out as I attempt to make use of it is why the images on mine do not switch – only the first image shows up!
    I even tried copy and pasting the demo of this tutorial line for line (substituting my own images of same name and size) yet still no luck having the images rotate.

    Please advise if you can thik of anything oobvious that I may be neglecting to do/include etc.

    Thank you very much!

    Sincerely

    carl

  57. [...] Create an Image Rotator with Description (CSS/jQuery) (tags: slideshow jquery css) [...]

  58. kelik on May 28th, 2009

    what can create that script to joomla module?

  59. Ludo on May 29th, 2009

    Excellent!!!

    Just an automated version to complete the work ;-)

  60. Carlos on May 29th, 2009

    @ Lochlan I’ve tried to replace the original code with yours for automatic slide but it is not working, where I should put your new code? I need to leave the one described in the tutorial plus the one you did? it is not working for me.

    I will appreciate if somebody can guide me.

    Thank you.

  61. David on June 2nd, 2009

    is there a way to add a scroll bar for the thumbnail section? if so, what is the code?

  62. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  63. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  64. Maverick on June 6th, 2009

    wow, very very nice script……. looks great

  65. Soh Tanaka on June 6th, 2009

    David, the easiest way to add a scroll bar is to add a overflow: auto; to your image_thumb class~ You can also look into js scroll bars to make it look nicer~

  66. Brandon on June 7th, 2009

    This was a super amazing tutorial and answered something I’ve been looking for ages.

    When I first put up my website I wanted a simple news ticker like various big sites like nba.com, espn.com and mtv.com. I found a few flash tutorials and also could easily make a flash script that I could manually update… which was inconvenient. I had been looking for a css script that I could implement with wordpress and make it more automatically updated.

    http://brandonmitchell.org/?page_id=123 – you can see the old flash script I used, it works and looked fine but was a pain to update.

    http://brandonmitchell.org/ – this is the new version that your tutorial helped me make. It’s all generated by posts in wordpress, so I just add a post fill out a few fields (upload image, description) and it updates on its own without editing any code. It works amazing and has solved something huge for me (I’m still finishing up everything but so far it does what I want it to do… I’m still working on getting the auto image change to work).

    I’d like to thank you Soh for your amazing tutorial, I’ll be sure to credit you when I’m done fixing my website :)

  67. [...] Create an Image Rotator with Description (CSS/jQuery) An image rotator is one great way to display portfolio pieces, eCommerce product images, or even as an image gallery. Although there are many great plugins already, this tutorial will help you understand how the image rotator works and helps you create your own from scratch. [...]

  68. Tom on June 8th, 2009

    great tutorial. Will test it out right away

  69. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  70. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  71. Constantine on June 10th, 2009

    Love it. Thank you.

  72. joxe on June 12th, 2009

    thanks for this, but i have 1 dude, how can i show the desc box out of the jpg, at the bottom for have more space to xplain my product, i did try but i cant, hope your help, many thanks.

  73. joxe on June 15th, 2009

    please somebody help me

  74. John on June 16th, 2009

    Is it possible to add more to the list under image_thumb Section and not push the container down? It will slide vertically instead if there are more to that list? Right now there are 6. What if I have 12?

  75. [...] Create an Image Rotator with Description (CSS/jQuery) Courtesy of Design M.A.G [...]

  76. mblack on June 22nd, 2009

    this is probably a question with an obvious solution, but how do I make it so the description is in the “hide” state by default, as opposed to showing up on load?

  77. apt on June 22nd, 2009

    Can i have the Nick Sumpter example slide automaticaly ?

    thanks !

  78. apt on June 23rd, 2009

    Hi lochlan,

    Here is the code i put, and that does not work with me:

    /************/

    jQuery(function(){

    $(”.main_image .desc”).show(); //Show Banner
    $(”.main_image .block”).animate({ opacity: 0.65 }, 1 ); //Set Opacity
    $(”.image_thumb ul li:first”).addClass(’active’); //Add the active class (highlights the very first list item by default)

    $(”.main_image img”).stop().animate({ opacity: 0}, 650 );
    $(”.main_image .block”).stop().animate({ opacity: 0, marginTop: -imgDescHeight }, 650 , function() {
    $(”.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginTop: “0?}, 1700 );
    $(”.main_image img”).stop().attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 650 );

    //runs function on click
    $(”.image_thumb ul li”).click(function () {
    $active = $(this);
    slideSwitchClick();
    })
    //runs function on click “next”
    $(”.nextTour”).click(function () {
    clearInterval(playSlideshow);
    $active = $(’.image_thumb ul li.active’).next();
    playSlideshow = setInterval( “slideSwitchTimed()”, 6000 );
    if ( $active.length == 0 ) $active = $(’.image_thumb ul li:first’); //goes back to start when finishes
    slideSwitch();
    })

    //runs function on click “prev”
    $(”.prevTour”).click(function () {
    clearInterval(playSlideshow);
    $active = $(’.image_thumb ul li.active’).prev();
    playSlideshow = setInterval( “slideSwitchTimed()”, 6000 );
    if ( $active.length == 0 ) $active = $(’.image_thumb ul li:last’); //goes back to start when finishes
    slideSwitch();
    })

    .hover(function(){ //Hover effects on list-item
    $(this).addClass(’hover’); //Add class “hover” on hover
    }, function() {
    $(this).removeClass(’hover’); //Remove class “hover” on hover out
    });

    //runs function, set timer here
    $(function() {
    //setInterval( ’slideSwitchTimed()’, 6000 );
    playSlideshow = setInterval( “slideSwitchTimed()”, 6000 );
    });

    //pauses on hover
    $(’.highlight’).hover(function() {
    clearInterval(playSlideshow);
    },
    function() {
    playSlideshow = setInterval( “slideSwitchTimed()”, 6000 );
    });

    });

    function slideSwitchTimed() {
    $active = $(’.image_thumb ul li.active’).next();
    if ( $active.length == 0 ) $active = $(’.image_thumb ul li:first’); //goes back to start when finishes
    slideSwitch();
    }

    function slideSwitchClick() {
    slideSwitch();
    }

    function slideSwitch() {
    var $prev = $(’.image_thumb ul li.active’);

    //Show active list-item
    $prev.removeClass(’active’);
    $active.addClass(’active’);

    //Set Variables
    var imgAlt = $active.find(’img’).attr(”alt”); //Get Alt Tag of Image
    var imgTitle = $active.find(’a’).attr(”href”); //Get Main Image URL
    var imgDesc = $active.find(’.block’).html(); //Get HTML of the “block” container
    var imgDescHeight = $(”.main_image”).find(’.block’).height(); //Find the height of the “block”

    if ($(this).is(”.active”)) { //If the list item is active/selected, then…
    return false; // Don’t click through – Prevents repetitive animations on active/selected list-item
    } else { //If not active then…
    //Animate the Description
    $(”.main_image img”).animate({ opacity: 0}, 250 );
    $(”.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(”.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0? }, 250 );
    $(”.main_image img”).attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
    });
    }
    return false;
    }//Close Function

    /************/

    thank you in advance to make corrections to this code.

  79. Eddie Gear on June 27th, 2009

    Hi there,

    Just wanted to say, this is AWESOME!

    Cheers,
    Eddie Gear

  80. [...] View Tutorial If you enjoyed this article, please consider sharing it! [...]

  81. robb on June 28th, 2009

    why didn’t i see it really rotate ?
    cos all i can see is just like a static non-animated slideshow.
    am i missing something ?

  82. hash on July 1st, 2009

    hi guys,
    i have a question. Im sorta new to jquery and css but im was playing around with this. I got most of it working but i dont know if i did my main_page div right. here it is:

    Close Me!

    Helping Hands
    8/11/2009
    OMG this is so annoying idk what i am doing.

  83. hash on July 1st, 2009

    ok last comment failed to show my problem. i shoould have put it in comments here it is again:

    //***

    Close Me!

    Helping Hands
    8/11/2009
    OMG this is so annoying idk what i am doing.

    ***//

  84. banny on July 2nd, 2009

    hi
    great tut
    what if i have to rotate the items of the list on left side how would u randomize the list items for pics like i want another or different pic to be at first node and selected eevery time a page is visited or refreshed
    thnx for help
    plz help me on this thnx

  85. [...] jQuery Image Rotator with Description [...]

  86. viki on July 8th, 2009

    this is relay great features. u can animated the pictures nice dear just try it

  87. A2b on July 12th, 2009

    nice work…,
    @ Lochlan, please can we see demo for the update that u have done ??

    thanks a lot

  88. mblack on July 14th, 2009

    I don’t think anyone responded before when I asked this, and it could just be that the answer is incredibly obvious, but how can I change the description to be in the “hide” state by default?

    Also, anyone interested can check out my application of this plug-in on my website, mattblackdesign.com.

  89. theINtoy on July 14th, 2009

    \r\nHi.\r\n\r\nI have been following this tut — great — THANKS!.\r\n\r\nI am stuck. I have many images that I want to rotate, and they are all different sizes. They all have the same size thumbnails, which is good, but I wanted to write a handler so that the larger image was normailised to the size of the main image container.\r\n\r\nThis is my first attempt at writing jQuery/JS. I have been around the web and got close to a solution…\r\n\r\nThe problem I have is that the image size never updates. The only image size I get is the image size of the original image. \r\n\r\nHow do I force the DOM (?) anything else to update to the size of the new big image so that I can calculate its size?\r\n\r\nEverything is the same as in the tut except:\r\n\r\n…\r\n $(\”.main_image .block\”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() { //Pull the block down (negative bottom margin of its own height)\r\n $(\”.main_image .block\”).html(imgDesc).animate({ opacity: 0.85, marginBottom: \”0\” }, 250 ); //swap the html of the block, then pull the block container back up and set opacity \r\n $(\”.main_image img\”).attr({ src: imgTitle , alt: imgAlt}); //Switch the main image (URL + alt tag);\r\n $(\”.main_image img\”).load(function(){ \r\n centerImage();\r\n }).animate({ opacity: 1}, 250 );\r\n });\r\n…\r\n\r\nAnd I have this function too:\r\n\r\nfunction centerImage() {\r\n var newImg = $(\”.main_image img\”);\r\n var mainImageHeight = $(\”.main_image\”).height(); //Find the height of the \”block\”\r\n var mainImageWidth = $(\”.main_image\”).width(); //Find the height of the \”block\” \r\n var width = $(newImg).width();\r\n var height = $(newImg).height();\r\n // alert( \”1: \” + width + \” x \” + height + \” [\" + mainImageWidth + \" x \" + mainImageHeight + \"]\” );\r\n if(width===0){width = $(newImg).attr(\”width\”);}\r\n if(height===0){height = $(newImg).attr(\”height\”);}\r\n \r\n //alert( \”2: \” + width + \” x \” + height + \” [\" + mainImageWidth + \" x \" + mainImageHeight + \"]\” );\r\n \r\n var top = (mainImageHeight – height) / 2;\r\n var left = (mainImageWidth – width) / 2;\r\n if ( ( mainImageWidth < width ) || ( mainImageHeight heightRatio)\r\n {\r\n ratio = widthRatio; \r\n top = 0;\r\n left = 0; \r\n }\r\n \r\n // calculate the new sizes from the ratio…\r\n width = Math.round(width/ratio);\r\n height = Math.round(height/ratio); \r\n //$(newImg).width(width).height(height);\r\n }\r\n //alert( \”3: \” + width + \” x \” + height + \” [\" + mainImageWidth + \" x \" + mainImageHeight + \"]\” );\r\n $(newImg).css({\r\n marginTop: (mainImageHeight – height) / 2,\r\n marginLeft: (mainImageWidth – width) / 2,\r\n width: width,\r\n height: height\r\n });\r\n \r\n};\r\n\r\n\r\nWithin centerImage, the calls \r\n\r\nvar newImg = $(\”.main_image img\”);\r\n…\r\nvar width = $(newImg).width();\r\nvar height = $(newImg).height();\r\n\r\nALWAYS return the width and height of the 1st image. How do I force it to use the width and height of the newImage?\r\n\r\nAny help would be appreciated.\r\n\r\nThanks.\r\n\r\n

  90. theINtoy on July 14th, 2009

    Hi.

    I have been trying to post the above message for a few days without success here is some of the code:

    /************/


    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() { //Pull the block down (negative bottom margin of its own height)
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 ); //swap the html of the block, then pull the block container back up and set opacity
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt}); //Switch the main image (URL + alt tag);
    $(“.main_image img”).load(function(){
    centerImage();
    }).animate({ opacity: 1}, 250 );
    });

    Next part to follow in next comment…

  91. theINtoy on July 14th, 2009

    Part 2:

    And I have this function too:

    function centerImage() {
    var newImg = $(“.main_image img”);
    var mainImageHeight = $(“.main_image”).height(); \/\/Find the height of the “block”
    var mainImageWidth = $(“.main_image”).width(); \/\/Find the height of the “block”
    var width = $(newImg).width();
    var height = $(newImg).height();

    if(width===0){width = $(newImg).attr(“width”);}
    if(height===0){height = $(newImg).attr(“height”);}

    var top = (mainImageHeight – height) / 2;
    var left = (mainImageWidth – width) / 2;
    if ( ( mainImageWidth < width ) || ( mainImageHeight heightRatio)
    {
    ratio = widthRatio;
    top = 0;
    left = 0;
    }

    // calculate the new sizes from the ratio…
    width = Math.round(width/ratio);
    height = Math.round(height/ratio);
    //$(newImg).width(width).height(height);
    }

    $(newImg).css({
    marginTop: (mainImageHeight – height) / 2,
    marginLeft: (mainImageWidth – width) / 2,
    width: width,
    height: height
    });

    };

    Within centerImage, the calls

    var newImg = $(“.main_image img”);

    var width = $(newImg).width();
    var height = $(newImg).height();

    ALWAYS return the width and height of the 1st image. How do I force it to use the width and height of the newImage?

    Any help would be appreciated.

    Thanks.

  92. [...] 10. Create an Image Rotator with Description (CSS/jQuery) [...]

  93. [...] Rotator with Description Source: http://designm.ag/tutorials/image-rotator-css-jquery/ Description: Create an image rotator with description using CSS and [...]

  94. noodlez on July 21st, 2009

    Hey mblack,

    Try this to hide the caption:
    //Show Banner
    $(“.main_image .desc”).show(); //Show Banner
    $(“.main_image .block”).hide();
    $(“.main_image .block”).animate({ opacity: 0.85 }, 1 ); //Set Opacity

    For everyone trying to get Lochlan’s code to work you will have to fix/retype all his single and double quote tags if you copy and paste from this page. His code does work and makes it auto play but it messes with the captions at the same time.

  95. [...] Enlace:http://designm.ag/tutorials/image-rotator-css-jquery/ [...]

  96. tiko ilk. on July 24th, 2009

    how can i have the same script of hide/show but for each picture with out the thumb’s.

    in my page i want to have each picture a hide/show button with info on the product instead of having thumbs on the side.

    thanx.

  97. Wes on July 26th, 2009

    Really cool. Got a question…

    Is there a way for the image is that is put into the main image box (when the thumbnail is clicked) to be automatically cropped to fit the box?

    Or for the window to dynamically change size depending on the size of the original image?

  98. banny on July 29th, 2009

    hi guys this is what i wanna achieve by rotation of tabs
    for eg tab 1 tab 2 tab 3 tab 4 <—this is on first page load tab 2 tab 3 tab 4 tab 1 <—- this is on 2nd page load or refresh tab 3 tab 4 tab 1 tab 2 <—– this is on 3rd page load and so on or i wont mind a total tab rotation regardless of which tab comes first like tab 4 tab 2 tab 1 tab 3 etc i hope u got it wat i meant by rotation so plz help me and hint me regarding this thanx

  99. [...] Create an Image Rotator with Description (CSS/jQuery)A great tutorial on how to create an image rotator/gallery using CSS and jQuery. It creates a clean UI for displaying a portfolio or general image gallery. [...]

  100. [...] Create an Image Rotator with Description (CSS/jQuery)A great tutorial on how to create an image rotator/gallery using CSS and jQuery. It creates a clean UI for displaying a portfolio or general image gallery. [...]

  101. Matt on August 3rd, 2009

    I can’t get the automatic image rotating to work?

    Can anyone help.

    This is a gret tut though.

  102. Matt on August 3rd, 2009

    The best image rotator i’ve seen on the web so far is on

    http://www.bbc.co.uk/radio1/

    Check it out, its got a hover and resize etc…

  103. Carlo on August 3rd, 2009

    BBC rotator Is really cool…

  104. Matthew Hartman on August 3rd, 2009

    Awesome work! Thanks for adding the fade effect, really simply and effective! Keep up the awesome work!

  105. [...] Create an Image Rotator with Description (CSS/jQuery)A great tutorial on how to create an image rotator/gallery using CSS and jQuery. It creates a clean UI for displaying a portfolio or general image gallery. [...]

  106. [...] Create an Image Rotator with Description (CSS/jQuery)A great tutorial on how to create an image rotator/gallery using CSS and jQuery. It creates a clean UI for displaying a portfolio or general image gallery. [...]

  107. [...] Create an Image Rotator with Description (CSS/jQuery)A great tutorial on how to create an image rotator/gallery using CSS and jQuery. It creates a clean UI for displaying a portfolio or general image gallery. [...]

  108. Bradford Sherrill on August 4th, 2009

    Great solution for a portfolio site

  109. haberler on August 4th, 2009

    hi,

    Very useful article i will use it.Thank you.

  110. Peter Stacho on August 5th, 2009

    How would I go about making the description hidden by default?

    Currently it shows the expanded description, but I want it to only show the toggle button by default.

  111. [...] Create an Image Rotator with Description (CSS/jQuery)A great tutorial on how to create an image rotator/gallery using CSS and jQuery. It creates a clean UI for displaying a portfolio or general image gallery. [...]

  112. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  113. Daro on August 7th, 2009

    Is very cool, but… i need your help!
    I need to add 2 arrows for left (previous) and right (next)
    Is it possible?

    Thank’s! and sorry for my english :S

  114. Noel Wiggins on August 7th, 2009

    Thanks for the tremendous tutorial.

    The final effect is truly awesome and I can’t wait to try it out

    Thanks & Regards
    Noel from nopun.com
    a professional graphic design studio

  115. [...] Rotação de Imagens com Descrição (CSS/jQuery) [...]

  116. [...] Create an Image Rotator with Description (CSS/jQuery) (tags: javascript ajax gallery jquery slideshow slider) [...]

  117. Thomas on August 8th, 2009

    Wow Great Tuts, thanks. I don’t know how I missed it.

  118. [...] Create an Image Rotator with Description (CSS/jQuery)A great tutorial on how to create an image rotator/gallery using CSS and jQuery. It creates a clean UI for displaying a portfolio or general image gallery. [...]

  119. [...] Create an Image Rotator with Description (CSS/jQuery) A great tutorial on how to create an image rotator/gallery using CSS and jQuery. It creates a clean UI for displaying a portfolio or general image gallery. [...]

  120. Unibands on August 12th, 2009

    Sweet! jQuery clearly showing it’s the best library for JS out there. Thanks for this so much! Might convince my boss to use this instead of MooTools! :)

  121. darkcable on August 12th, 2009

    Are you apart of this as well?
    http://newsrotator.codeplex.com/

  122. منتديات ماى بكتشرز on August 13th, 2009

    jQuery clearly showing it’s the best library for JS out there.

  123. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  124. Nikola on August 14th, 2009

    hi,

    can you explain a bit more, how to make it automated rotation?

  125. jatropha on August 18th, 2009

    Really nice effect and implementation. Re: the lag between text and image loading — I have that problem too. Is there a way to preload all images via jQuery? That’d really make this sing. Ld

  126. [...] Create an image rotator with description Bookmarks: Diese Icons verlinken auf Bookmark Dienste bei denen Nutzer neue Inhalte finden und mit anderen teilen können. [...]

  127. Jake Knight on August 21st, 2009

    Thanks for the great tutorial. I’ve really learned a lot by working with the code.
    Here’s my version of the tutorial

    http://www.wkdesignstudio.com/indexNew.htm

  128. Brad on August 21st, 2009

    Very nice article. Found exactly what I was looking for.

  129. Dave on August 23rd, 2009

    Great effect using Jquery…space saver too!

    Dave

  130. Kevin Mario on August 25th, 2009

    Hi guys,

    I’m building a version of this here:
    http://lunarist.com/studentedge/content-slider-2009/index-slider.html

    and I’m having trouble of getting it to auto-rotate.. I’ve followed lochlans method but still can’t get it right.

    At the moment I’m quite desperate and am willing to pay ( through Paypal or any payment method you prefer ) so if anyone is confident they can do this, please email me at: kevin.mario at gmail dot com

    Looking forward to replies!

  131. raiylo on August 27th, 2009

    why this slider dont wanna show image ? :/ it looks like that slider cant load image :/

    please reply

  132. banny on August 28th, 2009

    can we use image maps instead of just images with this thing ?

  133. [...] Create an Image Rotator with Description (CSS/jQuery) A great tutorial on how to create an image rotator/gallery using CSS and jQuery. It creates a clean UI for displaying a portfolio or general image gallery. [...]

  134. [...] Image Rotator with Description An image rotator is one great way to display portfolio pieces, eCommerce product images, or even as an image gallery. Although there are many great plugins already, this tutorial will help you understand how the image rotator works and helps you create your own from scratch. [...]

  135. benoit on September 14th, 2009

    here’s my code with a timer when you click on item

    $(document).ready(function() {
    $(“.main_image .desc”).show(); //Show Banner
    $(“.main_image .block”).animate({ opacity: 0.65 }, 1 ); $(“.image_thumb ul li:first”).addClass(‘active’); //runs function on click
    $(“.image_thumb ul li”).click(function () {
    var imgAlt = $(this).find(‘img’).attr(“alt”);
    var imgTitle = $(this).find(‘a’).attr(“href”);
    var imgDesc = $(this).find(‘.block’).html();
    var imgDescHeight = $(“.main_image”).find(‘.block’).height();

    if ($(this).is(“.active”)) {
    return false;
    } else {
    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt});
    });
    }

    $(“.image_thumb ul li”).removeClass(‘active’);
    $(this).addClass(‘active’);
    return false;$active = $(this);
    slideSwitchClick();
    })
    .hover(function(){

    $(this).addClass(‘hover’);
    clearInterval(playSlideshow);
    playSlideshow = setInterval(’slideSwitchTimed()’, 7000 );
    }, function() {
    $(this).removeClass(‘hover’);
    });

    //runs function, set timer here
    $(function() {
    playSlideshow = setInterval(’slideSwitchTimed()’, 7000 );
    });
    });

    function slideSwitchTimed() {
    $active = $(‘.image_thumb ul li.active’).next();
    if ( $active.length == 0 ) $active = $(‘.image_thumb ul li:first’);
    slideSwitch();
    }

    function slideSwitchClick() {
    slideSwitch();
    }

    function slideSwitch() {
    var $prev = $(‘.image_thumb ul li.active’);

    //Show active list-item
    $prev.removeClass(‘active’);
    $active.addClass(‘active’);

    //Set Variables
    var imgAlt = $active.find(‘img’).attr(“alt”);
    var imgTitle = $active.find(‘a’).attr(“href”);
    var imgDesc = $active.find(‘.block’).html();
    var imgDescHeight = $(“.main_image”).find(‘.block’).height();

    if ($(this).is(“.active”)) {
    return false;
    } else {

    $(“.main_image img”).animate({ opacity: 0}, 250 );
    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
    });
    }
    return false;
    }

  136. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  137. PSD to HTML on September 14th, 2009

    This is really awesome. It is very unique and exactly what I have been looking for. This will go nicely for a project I am working on.

    Thanks for this. Keep up the good work amigo, greatly appreciated.

  138. Archane on September 17th, 2009

    I’m wondering if anyone can help me with a minor niggle I have found. The opaque box that contains the text is obviously designed to have a degree of transparency, however, this also gets applied to the html within it, making text lose is smoothness, any suggestions on how this be avoided?

  139. [...] will help you understand how the image rotator works and helps you create your own from scratch. Web Site Demo AKPC_IDS += "181,";Popularity: unranked [?] Share and [...]

  140. Irwin on September 23rd, 2009

    Is it possible to link to a specific image within the rotator?

  141. AnubisibunA on September 29th, 2009

    anyone tried this using the jQuery UI [ tabs ] as the list items?

    I’ve used something like the following on another slider w/good results

    $(“#id”).tabs({
    event:’mouseover’,
    fx:{opacity:’toggle’, duration:’fast’}
    // following is needed to prevent image jump
    }).mouseout(function(){
    $(this).tabs(‘abort’);
    });

  142. PorKy on October 2nd, 2009

    Hi everyone I’ve been reading all your comments since a little moment now but when I try “apts” or “benoits” script like this:

    $(document).ready(function() {
    $(”.main_image .desc”).show(); //Show Banner
    $(”.main_image .block”).animate({ opacity: 0.65 }, 1 ); $(”.image_thumb ul li:first”).addClass(’active’); //runs function on click
    $(”.image_thumb ul li”).click(function () {
    var imgAlt = $(this).find(’img’).attr(”alt”);
    var imgTitle = $(this).find(’a’).attr(”href”);
    var imgDesc = $(this).find(’.block’).html();
    var imgDescHeight = $(”.main_image”).find(’.block’).height();

    if ($(this).is(”.active”)) {
    return false;
    } else {
    $(”.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(”.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(”.main_image img”).attr({ src: imgTitle , alt: imgAlt});
    });
    }

    $(”.image_thumb ul li”).removeClass(’active’);
    $(this).addClass(’active’);
    return false;$active = $(this);
    slideSwitchClick();
    })
    .hover(function(){

    $(this).addClass(’hover’);
    clearInterval(playSlideshow);
    playSlideshow = setInterval(’slideSwitchTimed()’, 7000 );
    }, function() {
    $(this).removeClass(’hover’);
    });

    //runs function, set timer here
    $(function() {
    playSlideshow = setInterval(’slideSwitchTimed()’, 7000 );
    });
    });

    function slideSwitchTimed() {
    $active = $(’.image_thumb ul li.active’).next();
    if ( $active.length == 0 ) $active = $(’.image_thumb ul li:first’);
    slideSwitch();
    }

    function slideSwitchClick() {
    slideSwitch();
    }

    function slideSwitch() {
    var $prev = $(’.image_thumb ul li.active’);

    //Show active list-item
    $prev.removeClass(’active’);
    $active.addClass(’active’);

    //Set Variables
    var imgAlt = $active.find(’img’).attr(”alt”);
    var imgTitle = $active.find(’a’).attr(”href”);
    var imgDesc = $active.find(’.block’).html();
    var imgDescHeight = $(”.main_image”).find(’.block’).height();

    if ($(this).is(”.active”)) {
    return false;
    } else {

    $(”.main_image img”).animate({ opacity: 0}, 250 );
    $(”.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(”.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(”.main_image img”).attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
    });
    }
    return false;
    }

    it just doesn’t work :( . I’m a JS beginner so if someone could help me I would really appreciate it :) .

  143. PorKy on October 2nd, 2009

    It’s ok guys it works :) just forgot to write something in my script. So the mistake came from me :)

    The scripts work perfectly thanks !

  144. mark on October 6th, 2009

    Cool. very cool, but it would be nice if it has a loading before the picture goes up..

  145. NICKD on October 10th, 2009

    Can I find a source code of this somewhere?

  146. Steven Snell on October 10th, 2009

    Nickd,
    I’m not sure what you’re asking for. Soh has provided all of the code in the tutorial.

  147. apt on October 10th, 2009

    The code still does not work with me.

    I do not know how he has run at Porky?

    Can you tell us what you do Porky, or simply put your code that works here?

    Thank you.

  148. Travis on October 16th, 2009

    When I use Benoit’s code everything seems to be working wonderfully except for the show/hide button to hide the “.block” of text (or the preview text on the opacity layer).

    I added:

    $(“a.collapse”).click(function(){
    $(“.main_banner .block”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    return false;
    });

    because there was no reference to “a.collapse” in Benoit’s code but it still doesn’t work. Any ideas?

    Did I place it in my script wrong? Here’s where I put it:

    [top of script goes here]
    ……..
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
    });
    }
    return false;

    // I added this
    $(“a.collapse”).click(function(){
    $(“.main_banner .block”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    return false;
    });
    // this is the last of what I added

    }

  149. tops-post.com on October 16th, 2009

    Great tut

    Great effect using Jquery

    i like it !

  150. tutorial blog on October 19th, 2009

    thank for share.

    it very useful

  151. [...] On many portfolios websites, javascripts sliders on homepage are now very common, this is why I hesitated to feature that one. But seriously, it may be common, it looks so great! » View tutorial [...]

  152. Just some guy on October 22nd, 2009

    For those of you having trouble getting the auto rotate scripts to work – watch the character encoding when you copy and paste the code from the comments section. Make sure all double and single quotes are correct according to your encoding.

  153. Jeff on October 22nd, 2009

    Can the thumbs on the right side be repeated as well on the left side? I would like to have four on each side of the main image than six on one side. How to go about this?

  154. jyoseph on October 23rd, 2009

    Freaking really solid instruction and demo dude, nicely done. Thanks for sharing!

  155. [...] will help you understand how the image rotator works and helps you create your own from scratch. Direct Link Live [...]

  156. mackem on October 26th, 2009

    Hi,
    Great tutorial, love the effect. Modified it for an index page:

    http://web.mydns.net.nz/explorenz.co.nz/index.html

    Got a couple of glitches. The 2nd line of the small text in the main image box is flush left to the box for some reason. Other problem is loading of the main images. Very slow sometimes. Needs at least one complete cycle of clicks before it will work smoothly.

  157. stylin328 on October 27th, 2009

    Anyway to make it so the big images are clickable to a url? Not just the download now button but the main big image?

    working on this : http://dev.pure9studios.com/_djbooth/JQ/

  158. neill on October 29th, 2009

    Benoits script is almost perfect except for me, the image only fades on the auto rotate?

    If you click one of the buttons, the image pops straight up and doesnt fade in.

    Anybody else got this problem.

  159. Steve on October 29th, 2009

    Excellent! Top stuff!

  160. snick on October 31st, 2009

    The image loads lit bit slow.Can increase the speed.

  161. Jessica on November 1st, 2009

    I love your image rotator! Excellent design! What I was wondering was if it is possible to have more than 5 images and if it can automatically go to the next image on the list or have a next button?

    Thanks in advance!

  162. [...] View Demo | Go to Tutorial [...]

  163. Marcelo Gomes on November 6th, 2009

    Hi,
    I like very much this script.

    But, I made a little modification to use with news. Got the original code with effect, add a few lines with rotation and change few tags in div for Google SEO. The link cannot point to a imagem, but the final url.

    All code and css can be view in http://www.bebidaboa.com.br

    Enjoy!

  164. [...] Image Rotator with Description | Demo [...]

  165. Norm Works on November 6th, 2009

    Hello
    Thank you.
    Nice aplication.

  166. [...] 1 – Create an Image Rotator with Description [...]

  167. tuna on November 10th, 2009

    good tutorial, thanks..

  168. saidawy on November 12th, 2009

    nice tutorial

    Thanks for this so much!

  169. Trisha on November 14th, 2009

    This is amazing! Gorgeous and it totally works, even for a non programmer. Im gonna use it all the time… Soh, you can design your ass off.

  170. [...] Image Rotator with Description | Demo An image rotator is one great way to display portfolio pieces, eCommerce product images, or even as an image gallery. Although there are many great plugins already, this tutorial will help you understand how the image rotator works and helps you create your own from scratch. [...]

  171. Jessica on November 15th, 2009

    Thank you Marcelo! This a great riff off the original which is also terrific!

  172. Michael Azar on November 16th, 2009

    This is awesome, i did notice there is a delay after the image changes. So you click, the descr block goes down and comes up with new descr, then the image swaps. is there any way to correct this? In my sample the images are all < 50k. Can anyone help me please? here is my link:

    http://dev.linkedinfaith.com/dev/slideViewer/slideViewer_barNav.cfm

    Thanks, great job!

  173. saidawy on November 17th, 2009

    Great tutorial

    Thank you

  174. paigrove on November 18th, 2009

    to travis:

    $(document).ready(function() {
    $(“.main_image .desc”).show(); //Show Banner
    $(“.main_image .block”).animate({ opacity: 0.65 }, 1 ); $(“.image_thumb ul li:first”).addClass(‘active’); //runs function on click
    $(“.image_thumb ul li”).click(function () {
    var imgAlt = $(this).find(‘img’).attr(“alt”);
    var imgTitle = $(this).find(‘a’).attr(“href”);
    var imgDesc = $(this).find(‘.block’).html();
    var imgDescHeight = $(“.main_image”).find(‘.block’).height();

    if ($(this).is(“.active”)) {
    return false;
    } else {
    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt});
    });
    }
    $(“a.collapse”).click(function(){
    $(“.main_image .block”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    });

    $(“.image_thumb ul li”).removeClass(‘active’);
    $(this).addClass(‘active’);
    return false;$active = $(this);
    slideSwitchClick();
    })
    .hover(function(){

    $(this).addClass(‘hover’);
    clearInterval(playSlideshow);
    playSlideshow = setInterval(’slideSwitchTimed()’, 7000 );
    }, function() {
    $(this).removeClass(‘hover’);
    });

    //runs function, set timer here
    $(function() {
    playSlideshow = setInterval(’slideSwitchTimed()’, 7000 );
    });
    });

    function slideSwitchTimed() {
    $active = $(‘.image_thumb ul li.active’).next();
    if ( $active.length == 0 ) $active = $(‘.image_thumb ul li:first’);
    slideSwitch();
    }

    function slideSwitchClick() {
    slideSwitch();
    }

    function slideSwitch() {
    var $prev = $(‘.image_thumb ul li.active’);

    //Show active list-item
    $prev.removeClass(‘active’);
    $active.addClass(‘active’);

    //Set Variables
    var imgAlt = $active.find(‘img’).attr(“alt”);
    var imgTitle = $active.find(‘a’).attr(“href”);
    var imgDesc = $active.find(‘.block’).html();
    var imgDescHeight = $(“.main_image”).find(‘.block’).height();

    if ($(this).is(“.active”)) {
    return false;
    } else {

    $(“.main_image img”).animate({ opacity: 0}, 250 );
    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
    });
    }
    return false;
    }

  175. [...] 4. Image rotator with preview [...]

  176. [...] Tutorial Demo VN:F [1.7.5_995]please wait…Rating: 0.0/10 (0 votes cast)VN:F [1.7.5_995]Rating: 0 (from 0 votes)Share it Tags: CSS, Jquery, tutorials This entry was posted on November 22, 2009 at 2:50 am, and is filed under CSS, Jquery, Tutorial. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. [...]

  177. john on November 25th, 2009

    Hi ,
    I am new to jquery and please help me out to accomplish this small feature in this gallery.
    How can i change image source of thumbnail on active/selected and hover.
    Many Thanks,
    John

  178. joh on November 25th, 2009

    how can i change the thumbnail image on hover or selected.
    Thanks

  179. Lala on November 25th, 2009

    Thank you for share this tutorial,
    I’ll practice it shortly

  180. Sabrina on November 26th, 2009

    Hello,

    This is exacly what i am looking for. but one question.

    (see my website) http://www.mellowmedia.nl/test

    The Hover where there come an arrow that should stay if it is active…

    how do i do that?????

    ( i’ll hope i’m clear enough…)

    greets

    Sabrina

  181. [...] Create an Image Rotator with Description (CSS/jQuery) Tweetez-le !Partagez-le sur FacebookPartagez-le sur del.icio.usTomber sur un bon truc ? Partagez cet article sur StumbleUponDiggez-le !Buzzez-le !Ajoutez-le à Google Bookmarks Article(s) sur le même sujet : [...]

  182. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  183. jazio on November 28th, 2009

    By adding the property display:none to .main_image .block you can set the .desc of the .main_image to stay hide until the button is hit. This is useful when you find the image description annoying.

    Regards

  184. apt on November 29th, 2009

    I am looking how to get the mouseover effect on small images to see larger image corresponding

  185. [...] Image Rotator with Description | Demo [...]

  186. jazio on December 2nd, 2009

    Soh it would be useful to have the big picture clickable so I can point to a page section which the picture describes.

    I noticed you only can set one anchor for all six pictures which is inconvenient. The other anchors are occupied. I also tried to set the onclick (window.open… handler on anchors but it won’t work. Do you have an idea?

    Many thanks and appreciation

    Jazio

  187. Mustafa on December 2nd, 2009

    GREAT !

  188. indialike on December 3rd, 2009

    Great tutorial, I like very much this script. thanks

  189. [...] 3. Create an Image Rotator with Description (CSS/jQuery) [...]

  190. insaat on December 7th, 2009

    was really good work thanks:)

  191. sahibinden on December 7th, 2009

    I did this work was very good:)

  192. C Kent on December 9th, 2009

    Hi,

    Does anyone have sample code they could share regarding putting this into wordpress. The part I am stuck on is the “main_image”? I know I can while loop through the image_thumb list.

    Thank you

  193. jazio on December 10th, 2009

    Watch http://www.jazio.net for a demo.

  194. Hein on December 11th, 2009

    Great Suff!!! Exactly what i’m looing for! Going to change the skin abit and put this home page on MyanmarBagan.com.

  195. [...] 3. Create an Image Rotator with Description (CSS/jQuery) [...]

  196. [...] product images, or even as an image gallery. DesignMag has published a tutorial teaching us how to Create an Image Rotator with jQuery and CSS. It will help you understand how the image rotator works and helps you create your own from [...]

  197. andreas on December 21st, 2009

    in case you are linking images from another server, so as to avoid this delay that some of you might be experiencing, you can preload your images:
    (put this script directly under before anything else)

    jQuery.preloadImages = function()
    {
    for(var i = 0; i<arguments.length; i++)
    {
    jQuery("”).attr(“src”, arguments[i]);
    }
    }

    $.preloadImages(“here you add the links to your images”,
    “http://www.sohtanaka.com/web-design/examples/image-rotator/banner2.jpg”,
    “http://www.sohtanaka.com/web-design/examples/image-rotator/banner4.jpg”);

  198. Kevin Mario on December 21st, 2009

    I just realized that the link to my example is broken, please visit:

    http://www.lunarist.com/studentedge/new-website-2009/index-slider-general.html

    instead for a tried-and-tested case example implementation of Soh’s Image Rotator ;)

    Kev

  199. pkj on December 22nd, 2009

    how to call the fn in reverse? That is on loading the the marker should hide and not in toggle case. please help me

  200. Michel on December 22nd, 2009

    I could use some help. I’m trying to get this really cool Rotator in my Magento website.

    JQuery is installed trough the Magento System:

    The javascript code for this rotator:
    http://www.bengeltje.com/js/jquery/banner.js

    The CSS code for this rotator:
    http://www.bengeltje.com/skin/frontend/default/f002/css/banner.css

    I hope you can help me!

  201. James on December 25th, 2009

    Fabulous tutorial. Helped a lot in my site redesign. Thanks.

  202. [...] 6. Image Rotator with Description (CSS/jQuery) [...]

  203. Rob on December 29th, 2009

    This is an awesome feature. I really appreciate the work.

    I have one problem I am hoping I can get help with though. I have everything set to auto rotate but the images do not change.

    Here is my site:

    http://www.pierevents.com/

    and here is the code:

    // Code for News Rotation… Need jQuery
    // Changed by Marcelo Gomes – marcelo@webemsegundos.com.br
    function slideSwitchTimed() {
    $active = $(‘.image_thumb ul li.active’).next();
    if ( $active.length == 0 ) $active = $(‘.image_thumb ul li:first’); //goes back to start when finishes
    $active.trigger(“rodatempo”);
    }
    $(document).ready(function() {

    //Show Banner
    $(“.main_image .desc”).show(); //Show Banner
    $(“.main_image .block”).animate({ opacity: 0.85 }, 1 ); //Set Opacity

    $(“.main_image img”).click(function(){
    if ($(this).attr(“codlink”) != ”) {
    document.location = $(this).attr(“codlink”);
    }
    });
    $(“.main_image .block”).click(function(){
    if ($(this).attr(“codlink”) != ”) {
    document.location = $(this).attr(“codlink”);
    }
    });

    $(“.image_thumb ul li”).bind(“rodatempo”, function(){
    //Set Variables
    var imgAlt = $(this).find(‘img’).attr(“alt”); //Get Alt Tag of Image
    var imgTitle = $(this).find(‘a’).attr(“img”); //Get Main Image URL
    var imgDesc = $(this).find(‘.block’).html(); //Get HTML of block
    var imgDescHeight = $(“.main_image”).find(‘.block’).height(); //Calculate height of block

    if ($(this).is(“.active”)) { //If it’s already active, then…
    return false; // Don’t click through
    } else {
    //Animate the Teaser
    $(“.main_image img”).animate({ opacity: 0}, 250 );
    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(“.main_image .block”).css(“margin”, “0px 0px 0px 5px”).css(“fontSize”, “14px”).css(“fontWeight”, “bold”);
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt}).css(“cursor”,”pointer”).animate({ opacity: 1}, 250 );
    });
    }

    $(“.image_thumb ul li”).removeClass(‘active’); //Remove class of ‘active’ on all lists
    $(this).addClass(‘active’); //add class of ‘active’ on this list only
    return false;

    }) .hover(function(){
    $(this).addClass(‘hover’);
    }, function() {
    $(this).removeClass(‘hover’);
    });

    //Click and Hover events for thumbnail list
    $(“.image_thumb ul li:first”).addClass(‘active’);
    $(“.image_thumb ul li”).click(function(){
    clearInterval(playSlideshow);
    $(this).trigger(“rodatempo”);
    });

    //Toggle Teaser
    $(“a.collapse”).click(function(){
    $(“.main_image .block”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    });

    playSlideshow = setInterval( “slideSwitchTimed()”, 6000 );
    $(“#main_image”).css(“display”, “none”);
    $(“.image_thumb”).css(“display”, “block”);

    });
    // End Code for News Rotation

    Any Ideas???

  204. Jeff on December 29th, 2009

    Maybe I missed it, but has anyone found a way to inject html (ajax call) into where the main image shows & maybe showing a loading gif while it loads?

    Any urls or pointers in the right direction would be greatly appreciated.

  205. Rob on December 29th, 2009

    I also just noticed that when you click the links on the right it just pulls up the image it is referencing and not changing the rotator.

  206. Guillem on December 31st, 2009

    Very nice piece of code we have here!

    But according to W3C we can’t have divs embeded into lists.
    To make it degrade, this is no big deal, you just have to use HTML anchor to make it work.

    Thanks to you I make my move to Jquery, Mootools is okay but not as powerfull as JQ.

  207. [...] “An image rotator is one great way to display portfolio pieces, eCommerce product images, or even as an image gallery. Although there are many great plugins already, this tutorial will help you understand how the image rotator works and helps you create your own from scratch.” Demo | Project Home [...]

  208. [...] En muchos sitios Web se presentan portfolios con imágenes, esta es buena técnica de presentación. Ver tutorial >> [...]

  209. Thor on January 7th, 2010

    Wery nice.
    I did add this but I have proplem with adding my text as we use special like æ, ö, þ and I cant use thta?

    How can I fix that?

    Thanks

  210. Guillem on January 7th, 2010

    @Thor :

    You just have to change the charset of your HTLM code to UTF-8, then it should work ;)

  211. Thor on January 7th, 2010

    Hi and thanks.
    I already has it in UTF-8 ? I did add this to Prestashop open source website on my localserver but I´m still having proplem b.c of this.

  212. Guillem on January 7th, 2010

    Well then, you better post your source code somewhere on the net so we can help.

    It could be your sql server returning raw data into your html document.

  213. Jeff Schram on January 7th, 2010

    I know I’m pretty late to this post, I was recently looking for a rotator and was happy with this. I needed to automate it, as many of you did too. I think I came up with a pretty simple solution, I added just a few extra lines and a couple functions. I’m not a jQuery wiz, there might be better ways of doing this, but it works. I even made the rotation stop when you hover over the main image area.

    Here’s the code, I notated where I made the changes to the original.

    ps, I added my contact info in the notations not to get credit, but just to give my email if you have any questions.

    $(document).ready(function() {

    //Show Banner
    $(“.main_image .desc”).show(); //Show Banner
    $(“.main_image .block”).animate({ opacity: 0.85 }, 1 ); //Set Opacity

    //Click and Hover events for thumbnail list
    $(“.image_thumb ul li:first”).addClass(‘active’);

    // * Code added by Jeff Schram, SchramDesign, http://schramdesign.com, email@schramdesign.com
    // * Adds a class ‘last’ to the last li to let the rotator know when to return to the first
    $(“.image_thumb ul li:last”).addClass(‘last’);

    $(“.image_thumb ul li”).click(function(){
    //Set Variables
    var imgAlt = $(this).find(‘img’).attr(“alt”); //Get Alt Tag of Image
    var imgTitle = $(this).find(‘a’).attr(“href”); //Get Main Image URL
    var imgDesc = $(this).find(‘.block’).html(); //Get HTML of block
    var imgDescHeight = $(“.main_image”).find(‘.block’).height(); //Calculate height of block

    if ($(this).is(“.active”)) { //If it’s already active, then…
    return false; // Don’t click through
    } else {
    //Animate the Teaser
    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt});
    });
    }

    $(“.image_thumb ul li”).removeClass(‘active’); //Remove class of ‘active’ on all lists
    $(this).addClass(‘active’); //add class of ‘active’ on this list only
    return false;

    }) .hover(function(){
    $(this).addClass(‘hover’);
    }, function() {
    $(this).removeClass(‘hover’);
    });

    //Toggle Teaser
    $(“a.collapse”).click(function(){
    $(“.main_image .block”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    });

    // * Code added by Jeff Schram
    // * if we are hovering over the image area, pause the clickNext function
    // * by default, our new pauseClickNext variable is false
    pauseClickNext = false;
    $(“.main_image”).hover(
    function () {
    pauseClickNext = true;
    },
    function () {
    pauseClickNext = false;
    }
    );

    // * Code added by Jeff Schram
    // * Define function to click the next li
    // * notice that it checks for a class of ‘last’, we added that above
    var clickNext = function(){
    if(!pauseClickNext) {
    /// find the next li after .active
    var $next_li = $(“li.active”).next(“li”);
    if($(“li.active”).hasClass(“last”) ){
    $(“.image_thumb ul li:first”).trigger(“click”);
    } else {
    $next_li.trigger(“click”);
    }
    }
    };

    // * Code added by Jeff Schram
    // * setTimeInterval to run clickNext
    setInterval(clickNext, 5000);

    });//Close Function

  214. SmashDesign on January 8th, 2010

    great toturial

    thanks a lot

  215. [...] Tutorial Tutorial Page [...]

  216. izdelava strani on January 10th, 2010

    having difficulties with this one, but its so intriging i have to try it and set it up to work

  217. [...] designm.ag/tutorials/image-rotator-css-jquery/ [...]

  218. [...] jQuery Image Rotator/News [...]

  219. Create an Image Rotator with Description…

    An image rotator is one great way to display portfolio pieces, eCommerce product images, or even as an image gallery. Although there are many great plugins already, this tutorial will help you understand how the image rotator works and helps you create…

  220. Mark Lee on January 18th, 2010

    Here you can see better results.www.accesstibettravel.com/default.aspx

  221. Corey Jones on January 19th, 2010

    Great Tutorial. This is perfect for a project I am currently working on. I will post final when I am done!

  222. [...] 2. Create an Image Rotator with Description [...]

  223. swine on January 25th, 2010

    I can’t figure out how to make the large image clickable so when it does come up, then you just have to click the large banner instead of the link provided in the tag.????????

  224. mackem on January 27th, 2010

    Hi, used it on the index page of http://www.explorenz.co.nz
    Doesn’twork in Safari 2. Any ideas?

  225. Seamus Fitzpatrick on February 2nd, 2010

    Just wondering, is it possible to add a next and previous buttons to this gallery??as well as having the option to click to the next image

  226. [...] Create an Image Rotator with Description [...]

  227. Corey Jones on February 4th, 2010

    As promised…here is a link to my version of the rotator.

    http://www.organic-baby-resource.com

    I wish I could get some help on the auto-rotate. I’ve tried to paste a few of the codes here, and they haven’t worked, so I stayed basic.

    Has anyone worked it out? I’m currently a jQuery newbie.

  228. Kevin Mario on February 4th, 2010

    @Corey Jones:

    Check by case example:
    http://www.lunarist.com/studentedge/new-website-2009/index-slider-general.html

    it’s got custom auto-rotate enabled ;)

  229. Eoin Casey on February 5th, 2010

    Anyone able to get the slideshow, fade in, forward backward buttons and the “open/close” text captions? Im having trouble with it, as all work, besides when you click on close on the captions!

  230. Corey Jones on February 5th, 2010

    @Kevin

    Hmmm…that didn’t work for me for some reason. Just straight replacing the code did not produce an auto-rotate sequence. IT was still static, except now the description window changed dimensions, which I’m sure I can figure out how to change it back. In fact, when I clicked on the banner to load into the window, the first picture faded out and then I went immediately to the article. The thumbnail did not load into the main image window.

  231. Corey Jones on February 5th, 2010
  232. David McKillen on February 8th, 2010

    It would also be nice to be able to make the larger images (that appear) hyperlinks – as from a usability perspective many people might think to click on the main image – or think it to be a link. I suppose you might be able to do something with $(“.main_image”).onclick( …. great tut though!

  233. Alan on February 9th, 2010

    I managed to get my custom design with the timer working great now. Thanks for the great tutorial and help guys.

    http://www.itsfilmtastic.co.uk/contentslider/contentslider.html

  234. David McKillen on February 9th, 2010

    Here is another version of the code that includes rotation but prevents it from moving forward if you are mousing over the list of nav links on the right. It also adds the ability to put a link on the larger image too if you want (not just the slide up box text content). For the image link bit you will have to give each image a class name (eg: ) -> here I just added class=”ramp” so now the javascript can act on it on click. Feel free to email if I’ve messed anything up or you spot something: david@mckillen.net. Huge tribute though to Soh and Jeff Schram too – nice work guys.

    $(document).ready(function() {

    //Show Banner
    $(“.main_image .desc”).show(); //Show Banner
    $(“.main_image .block”).animate({ opacity: 0.80 }, 1 ); //Set Opacity

    //Click and Hover events for thumbnail list
    $(“.image_thumb ul li:first”).addClass(‘active’);

    // * Code added by Jeff Schram, SchramDesign, http://schramdesign.com, email@schramdesign.com
    // * Adds a class ‘last’ to the last li to let the rotator know when to return to the first
    $(“.image_thumb ul li:last”).addClass(‘last’);

    $(“.image_thumb ul li”).click(function(){
    //Set Variables
    var imgAlt = $(this).find(‘img’).attr(“alt”); //Get Alt Tag of Image
    var imgTitle = $(this).find(‘a’).attr(“href”); //Get Main Image URL
    var imgDesc = $(this).find(‘.block’).html(); //Get HTML of block
    var imgDescHeight = $(“.main_image”).find(‘.block’).height(); //Calculate height of block

    if ($(this).is(“.active”)) { //If it’s already active, then…
    return false; // Don’t click through
    } else {
    //Animate the Teaser
    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 ,
    function() {
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.80, marginBottom: “0″ }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt});
    });
    }

    $(“.image_thumb ul li”).removeClass(‘active’); //Remove class of ‘active’ on all lists
    $(this).addClass(‘active’); //add class of ‘active’ on this list only
    return false;

    }) .hover(function(){
    $(this).addClass(‘hover’);
    }, function() {
    $(this).removeClass(‘hover’);
    });

    // * Code added by Jeff Schram
    // * if we are hovering over the image area, pause the clickNext function
    // * by default, our new pauseClickNext variable is false
    pauseClickNext = false;

    $(“.main_image .ramp”).hover(
    function ()
    {
    pauseClickNext = true;
    }
    ,
    function ()
    {
    pauseClickNext = false;
    }
    );

    … code continued in next post due to some posting glitch. >>>

  235. David McKillen on February 9th, 2010

    $(“.main_image .ramp”).hover(
    function ()
    {
    var obj= document.getElementById(“main-image”);
    obj.style.cursor=’pointer’;
    }
    );

    $(“.main_image .ramp”).click(
    function ()
    {
    if ( document.getElementById(“one”).className == “active”)
    {
    window.location=”http://www.google.com”;
    }
    else if ( document.getElementById(“two”).className == “active”)
    {
    window.location=”http://www.mckillen.net”;
    }
    else if ( document.getElementById(“three”).className == “active”)
    {
    window.location=”http://www.hoo.com”;
    }
    else if ( document.getElementById(“four”).className == “active”)
    {
    window.location=”http://www.tape.com”;
    }
    else if ( document.getElementById(“five”).className == “last active”)
    {
    window.location=”http://www.ask.com”;
    }
    }
    );

    //Toggle Teaser
    $(“a.collapse”).click(function(){
    $(“.main_image .block”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    });

    $(“.image_thumb”).hover(
    function ()
    {
    pauseClickNext = true;
    }
    ,
    function ()
    {
    pauseClickNext = false;
    }
    );
    // * Code credit to Soh Tanaka http://designm.ag/ and Jeff Schram, SchramDesign, http://schramdesign.com
    // * Define function to click the next link
    // * notice that it checks for a class of ‘last’, we added that above
    var clickNext = function(){
    if(!pauseClickNext) {
    /// find the next li after .active
    var $next_li = $(“li.active”).next(“li”);
    if($(“li.active”).hasClass(“last”) ){
    $(“.image_thumb ul li:first”).trigger(“click”);
    } else {
    $next_li.trigger(“click”);
    }
    }
    };

    // * Code added by Jeff Schram
    // * setTimeInterval to run clickNext
    setInterval(clickNext, 7000);

    });//Close Function

    http://www.mckillen.net web design

  236. David McKillen on February 9th, 2010

    Sorry – image example didn’t come through …. it was:

    a class=”ramp” href=”http://www. … etc.

  237. Eoin Casey on February 9th, 2010

    Anyone have the problem that the last image, when it fades out, is seen just before the next image is loaded?

  238. swine on February 9th, 2010

    @Eoin Casey

    You should load the banners in a display:none div like so: (right after the tag)

    @David McKillen
    I can’t get the BIG image to click?? Is there another way, not in the JS, but in the html????

  239. swine on February 9th, 2010

    @Eoin Casey

    <div style="display:none;">
    <img src="http://www.website.com/img/banner1.jpg" alt="" />
    <img src="http://www.website.com/img/banner2.jpg" alt="" />
    <img src="http://www.website.com/img/banner3.jpg" alt="" />
    <img src="http://www.website.com/img/banner4.jpg" alt="" />
    <img src="http://www.website.com/img/banner5.jpg" alt="" />
    <img src="http://www.website.com/img/banner6.jpg" alt="" />
    <img src="http://www.website.com/img/banner7.jpg" alt="" />
    </div>
  240. mike on February 11th, 2010

    im having the same problem as @Eoin Casey. the picture fades comes back up and then switches to the other picture.

  241. Matthew on February 11th, 2010

    Remember too that the data sets (images, text, dates… etc) can be loaded before hand with php wish ease. Makes this very dynamic, control the jquery/css look, let php do the foot work and push in the information. This is much smoother just dropping an image into a directory, adding a description, auto time stamp on addition.

  242. Darren on February 12th, 2010

    Hey,

    Great script, very nice!

    I’m trying to work out how to select which div by default is shown. I want different divs to be shown first depending on the page the visitor is on, but on each page load it returns to the first div in the list.

    Can anyone help?

    Thanks

  243. David McKillen on February 12th, 2010

    @Darren,

    Depends on whether you want this done dynamically with CSS or javascript or you are just wondering how the code sets it. You could do something similar to what is done with CSS to set a navigation button as “active”. In other words, “on page load set div X as active”.

    If however you are just wondering how to change the default active div statically (just hard coding it), you will notice the active div code states instead of .

    Does that help at all?

    David McKillen
    david@mckillen.net
    Twitter: davidmckillen

  244. David McKillen on February 12th, 2010

    @Darren

    … sorry it kicked my bit of code in the last post :)

    li class=”active” … instead of …. li class=”"

    Dave :)

  245. David McKillen on February 12th, 2010

    @Darren

    I should add – in order to change the li that the page automatically displays you will have to give each li an id and then change this line of code adding “three” or whatever id you give it:

    $(“.image_thumb ul #three li:first”).addClass(‘active’);

    Also you will have to change the default large picture div that displays when the page loads as currently it simply is a copy of the first li. So if for example you want the third li with id three to be the start li then you’ll have to replace the generic code for the default larger image div to be the same as that of the corresponding div for the third li. (Hard to explain but I hope that helps?? :) ).

  246. Darren on February 13th, 2010

    @David McKillen,

    Thank you so much for the advice, it worked.

    I didn’t do everything you specified, partly because the site I’m developing required a slightly different approach.

    As you rightly illustrated, the two-step approach of changing the first slide on shown to be identical to the one you want to appear, and then changing the li class to active on that particular slide was the trick in making it appear like it was set to that one by default.

    Thank you for the help.

    Darren

  247. David McKillen on February 14th, 2010

    Oh! Nice work Darren, way to get it sorted man (glad I could help)

    David McKillen
    Twitter: davidmckillen

  248. ky on February 14th, 2010

    hi!

    thanks for this. i try to use this on prestashop. the developer of my theme seems to use your code ( http://dgcraft.free.fr/blog/index.php/themes-prestashop/element-theme-prestashop/ ) but i think there’s a problem.
    please help. the rotator gets all product-titles/desc at the same time for the main-image-title/desc. you can see this at my page http://www.cool-japan.eu please help! here i post his code:

    {literal}

    $(document).ready(function() {

    //Show Banner
    $(“.main_image .desc”).show(); //Show Banner
    $(“.main_image .bloc”).animate({ opacity: 0.85 }, 1 ); //Set Opacity

    //Click and Hover events for thumbnail list
    $(“.image_thumb ul li:first”).addClass(‘active’);
    $(“.image_thumb ul li”).click(function(){
    //Set Variables
    var imgAlt = $(this).find(‘img’).attr(“alt”); //Get Alt Tag of Image
    var imgTitle = $(this).find(‘a’).attr(“href”); //Get Main Image URL
    var imgDesc = $(this).find(‘.bloc’).html(); //Get HTML of block
    var imgDescHeight = $(“.main_image”).find(‘.bloc’).height(); //Calculate height of block

    if ($(this).is(“.active”)) { //If it’s already active, then…
    return false; // Don’t click through
    } else {
    //Animate the Teaser
    $(“.main_image .bloc”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(“.main_image .bloc”).html(imgDesc).animate({ opacity: 0.85, marginBottom: “0″ }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt});
    });
    }

    $(“.image_thumb ul li”).removeClass(‘active’); //Remove class of ‘active’ on all lists
    $(this).addClass(‘active’); //add class of ‘active’ on this list only
    return false;

    }) .hover(function(){
    $(this).addClass(‘hover’);
    }, function() {
    $(this).removeClass(‘hover’);
    });

    //Toggle Teaser
    $(“a.collapse”).click(function(){
    $(“.main_image .bloc”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    });

    });//Close Function

    {/literal}

    {foreach from=$products item=product name=homeFeaturedProducts}
    {assign var=’productLink’ value=$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)}
    ($smarty.foreach.homeFeaturedProducts.total – ($smarty.foreach.homeFeaturedProducts.total % $nbItemsPerLine))}last_line{/if}”>

    {$product.name|escape:htmlall:’UTF-8′|truncate:30}
    {$product.description_short|strip_tags|truncate:60:’…’}
    {displayWtPrice p=$product.price}
    {l s=’view it’ mod=’homefeatured’}

    {/foreach}

    {foreach from=$products item=product name=homeFeaturedProducts}
    {assign var=’productLink’ value=$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)}
    ($smarty.foreach.homeFeaturedProducts.total – ($smarty.foreach.homeFeaturedProducts.total % $nbItemsPerLine))}last_line{/if}”>

    {$product.name|escape:htmlall:’UTF-8′|truncate:30}
    {$product.description_short|strip_tags|truncate:60:’…’}
    {displayWtPrice p=$product.price}
    {l s=’view it’ mod=’homefeatured’}

    {/foreach}

  249. ky on February 14th, 2010

    ps. once you change the product and come back everything is fine and it displays only one title/desc…
    is there a possibility to to smth like on page load show first title and desc?

  250. amjad on February 17th, 2010

    can anyone tell me how to save these coading step by step ?
    like html coding index.html , css coding style.css please tell me how to saveall these coding ? help me please

  251. Ce. on February 17th, 2010

    Hey you guys making code modifications why not post to pastebin or something of the like since posting your modified code into the comments area has turned into a total nightmare to go through? Especially those doing the oops my code didn’t quite post right etc… cmon guys!

  252. James on February 17th, 2010

    Does anyone have a final copy of the working code where it is fully automated they can post ?

    Thanks

  253. ky on February 17th, 2010

    sorry man!

    didn’t know about that. first try.
    http://pastebin.com/m25854274

    won’t happen again
    peace
    ky

  254. Eoin Casey on February 17th, 2010

    @swine

    Thanks for the help, but it still didnt work :( Do the images need to be preloaded? Or can they?

  255. Steve on February 17th, 2010

    Love this code! Excellent and powerful!

    See my implementation on the homepage here: – ImageArcade – Photography By Steve Ayres

    Thanks,
    Steve

  256. apt on February 17th, 2010

    steve,

    but it lacks something …

    when I put the mouse over small images normally face it will receive the corresponding detail

    then the effect on mouse over is not manage in this script!

  257. Matt Wright on February 18th, 2010

    We are looking for someone to help us integrate this code into a basic coldfusion page. Anyone interested in making a couple hundred dollars? I need this quick and don’t want to take the time to learn. Please email me at mwright4@cs.com – Basically I need to output 5 records from a DB and use the pics and info in those records into this code…

  258. Alex on February 19th, 2010

    Anyone know what licence this rotator comes under?

    Am i free to use it for any templates i create from themeforest?

    I’ll of course give the author credit (that goes without saying).

  259. Steven Snell on February 19th, 2010

    Alex,
    Yes, it can be used for templates or themes.

  260. Alex on February 19th, 2010

    Great stuff. Thanks for the speedy reply Steven.

  261. [...] Image Rotator: – As used on the home-page for the featured images. [...]

  262. Daniel Boone on February 25th, 2010

    Hello-

    Not sure if this is still an active discussion but does anyone know if you could pass video in this? If so could you point me in the right direction?

  263. Mike on February 25th, 2010

    Can anyone tell me why the image fades then the same image shows back up then the image changes? And it only happens on the first go around of the slider, in the second time the slider goes, I do not have this problem. Can anyone tell me why this is happening?

  264. Alex on February 25th, 2010

    Its got something to do with image loading delay. You could place all your images into 1 big image and use background positioning in css. But i’m sure theres a better solution. Or better still if all the images loaded on page open. Either ways its very annoying.

  265. Mike on February 25th, 2010

    @alex thanks for the response. yea it look very bed when it fades and comes back to the same image then switches .5 seconds after. It actually hurts my head to see it. I just cant figure how to fix it.

  266. advertising on February 28th, 2010

    Thank you for sharing this tutorial,

  267. scarlett on March 1st, 2010

    Loving it, and had an easy enough time skinning the design.

    Read through all the comments & tried to implement several directions for auto-advancement, and also pause on hover selection.

    I seem to not get it quite right each time. I know there’s the issue of removing curly quotes from @Lochlan’s code (which seemed promising), and I’ve been able to get thumbnails to advance, but not pull the correlating .main_image div, etc (always something).

    I’d be much obliged if someone could take a look at my implementation thus far and offer some help for auto-slide-advancement & slide pause on hover.

    Here’s the live test: http://perfectcirclemedia.com/design/echonest/slider/

    The main image is the same for all at the moment.

    Cheers!
    Scarlett

  268. scarlett on March 1st, 2010

    P.S. would like to make the whole .main_image a link as well.

  269. Jeff on March 1st, 2010

    $(“a.collapse”).click(function(){
    $(“.main_banner .block”).slideToggle(); //Toggle the description (slide up and down)
    $(“a.collapse”).toggleClass(“show”); //Toggle the class name of “show” (the hide/show tab)
    });

    Is there a way to make this the opposite? Hide the description and click to show it?

  270. Hannah on March 2nd, 2010

    it works amazing thanks a lot, JUST ONEEE little thing,
    everytime i click on”hide or show information” it automatically makes my scroll bar from my window to go to the top of my page,
    why? how can i fix it! it is annoying.

  271. Daniel Boone on March 2nd, 2010

    any one have an idea on how to pass video segments instead of still images? Any help would be great..

  272. teorico on March 3rd, 2010

    very thanks, great tutorial…

  273. Tom D on March 3rd, 2010

    Great Tutorial. I’m wondering if anyone has an example of the code used to integrate this into word press? Any help would be great.

  274. Ethno Urban on March 5th, 2010

    To Jeff:
    Is there a way to make this the opposite? Hide the description and click to show it?

    yeah You can do it very easyly:

    //Toggle Teaser
    $(“.block”).hide();
    $(“a.collapse”).click(function(){
    $(“.main_image .block”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    });

    Have a good day ;)

  275. Laura on March 5th, 2010

    has anyone had trouble using a .png file inside the div class=’block’ ?
    My png file is a curve.
    It can be viewd fine alone but after applying the javascript it doesn’t keep its opacity and has a black pixelated line along the edge.
    I have used all the png fixes out there with no luck. This happens only in IE 7.
    Thanks. Great tutorials and comments very helpful!

  276. Laura on March 5th, 2010

    found this site here that is helpful but i still can not get it to work without the black outline…
    http://jquery.khurshid.com/ifixpng.php

  277. Laura on March 5th, 2010

    anyone having problems with css drop down menus falling behind the jquery image rotator? In IE7

  278. seminyak villas on March 8th, 2010

    wow…

    this is what i’m looking for.
    thx…

  279. Hakim on March 10th, 2010

    Great.Thanks for the Article.

    But there is a slight difficulty.When I add one more Image to block.
    The Image_Thumb will get resized.

    Is there a way using Jquery to give a slider effect to Image_thumb division.

    I would really appreciate the help.Thanks in advance.

    Regards
    Hakim

  280. Hannah on March 13th, 2010

    I BEG FOR HELP :(

    just one detail, when i click to hide the info, it goes down like its supposed to, but at the same time it send me to the top of my page and its annoying…¿why? what code i should use to make it stay where i am in the page?

    this is the code for the click event that i have:

    //Toggle Teaser

    $(“a.collapse”).click(function(){
    $(“.main_image .block”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    });

    });//Close Function

    shoul it be blocked or something so it wont move?

  281. David McKillen on March 16th, 2010

    @ChrisMolnar:

    Chris – I have posted a working demo on what you were looking for here: http://www.mckillen.net/topbox.html

    Which includes the fading images and the linking larger/main images. I just made a few tiny tweaks to the existing code but it works the way I wanted it to now :) – hope you can take a look there and see if that helps? Again it might not be pretty but it works!

    Follow me on Twitter (if you dare :) ): davidmckillen
    david@mckillen.net

  282. David McKillen on March 16th, 2010

    @ChrisMolnar:

    To answer your other questions – this might not be the best way to do it but again it works:

    1) When the images fade in and out the first time, they don’t transition smoothly. Would preloading the images get rid of that hiccup? – It is my understanding yes that preloading the image would fix this.

    2) Is there a way to remove the “#” from the Hide/Show click? If the user is not at the top of the page, it bumps the browser to the top. – Yes, again it might not be “up-to-code” so to speak but simple removing the href=”#” fixes that. A better way would be to utilize onclick rather than a href here too but that’s a bit more coding :) .

    Follow me on Twitter (if you dare :) ): davidmckillen
    david@mckillen.net

  283. James on March 16th, 2010

    I kind of got my one working as well, but the problem I have is that I have other UL / LI tabs on the page and they now change automatically as well now ?
    Is there any way I can change it ?

    Thanks

  284. David McKillen on March 16th, 2010

    @James – did you try assigning your existing UL/LI tabs specific CSS classes? That way you specific their styles.

  285. James on March 16th, 2010

    I have kept the same code as above,with my new UL/LI i have them as a class called “tabs” and they run on using there own JQuery function. Its a bit hard to explain really and I don’t want to start pasting code here. You can have a look at my website above, its the tabs on the lower right hand side,

    If I were to add classes to my ul li how would I add that to the JQuery code above ? my css is all over the place really…

    Thanks

  286. Daniel Boone on March 16th, 2010

    Still hoping someone could give me a point in the right direction on passing video in image fields.

  287. Angela Karinn on March 24th, 2010

    Great Plugin! But, does anyone else have problems with it not working as an external script? I am using this on several pages & don’t like having redundant code. I’m baffled as to why it only works when it’s local to the page.

  288. David McKillen on March 25th, 2010

    @Angela

    Should work if all your references to the scripts and images are correct unless I’m mistaken. Maybe check to make sure all links are accurate.

    David McKillen
    Spoccer.com
    Twitter: Spoccer

  289. James on March 25th, 2010

    You can check out my website as an example.

  290. David on March 30th, 2010

    Is there a way to embed vimeo/youtube movies in the rotator.. or has anyone a workaround for this already?
    Thnx in advance!

  291. Daniel Boone on March 30th, 2010

    David-

    Hey man, I found a way to add in video using lightbox and mov files.

    fusioncorpdesign.com/beta/UK

    If you are interested. Let me know I can point you in the right direction

  292. Nauman Akhtar on April 5th, 2010

    This is nice, but image takes tooo much time to load.

  293. James on April 5th, 2010

    @Nauman,

    Don’t you want something like that have on the Skynews.com website ?

  294. Glenn on April 5th, 2010

    Hi David,

    Thanks we are a search engine marketing company and was looking for some basic layouts that clients may benefit for rather than using flash.

    Cheers
    Glenn

  295. Richard on April 5th, 2010

    Nice tut we will be looking to use in our bookkeeping services website.

    thnaks
    Richard

  296. John on April 6th, 2010

    If I have a lot more thumbnail how can I make only a few visible and also scrollable with the mouse-wheel

  297. Michael Joens on April 8th, 2010

    Is there a way to scale this down to fit withing a 400px place on a webpage… if so what all options do you change…. I’ve tried changing the CSS but then it goes all crazy?

    Thanks

  298. Rafal on April 9th, 2010

    Hi
    I wanted to develope this great tutorial further with embading some swf file instead of jpg for one of the slides, but when i put in this part a swf it just doesnt display anything. Does anyone knows how to implement flash into it ?

    here is the code i try :

    it works for gifs but its not what im searching for.

  299. Stephen McCann on April 13th, 2010

    Hi all,

    Just a heads up for anyone with the preloading images issue (the images appear after a delay).

    After looking into preloading using JavaScript (which I’m not the best at) I found a simpler CSS alternative.

    First add a div with an id such as “imageCache” and insert all the images you use in your rotator with the exception of the first image that is displayed eg:

    Then go into your CSS and set the display property of this div to none eg:

    # imageCache{
    display: none;
    }

    This means that when your page is loaded the browser will cache the specified images into memory but will not display them – then when the JavaScript for the rotator requests the images they are gathered from cache and not downloaded on the fly (which is the cause of the delay).

    Hope this helps anyone – PS check my usage of the code at

    http://dev.rhoderickdhu.com/ – still in development.

    Stephen.

  300. Stephen McCann on April 13th, 2010

    ^^^^^^^^
    note – above after the e.g. the example is missing (not sure why??? I definately put it in).

    I can confirm this method works. Hope this helps.

  301. Mike on April 14th, 2010

    @Stephen McCann, thank you so much! It is the perfect solution to the problem! YOU ARE THE BEST!!

  302. Stephen McCann on April 15th, 2010

    No problemo Mike, glad I could help!

  303. Alex on April 19th, 2010

    Anyway of adding a text link to another page on my site inside the sidebar ?
    The problem i’m having is, because the panel acts like a giant button, if i add a small text link link that will not work. I’m guessing its related to this: $(“.image_thumb ul li”).click(function(){

    Any ideas?

  304. dupledge on April 22nd, 2010

    Rafal

    I used the the following for flash loads

    First I created a small html file with a div to hold the call to the flash file like below

    In the main html file that call the jquery I create a element where I wanted to display the flash file

    then in the script file after the variables have been set I put the following code. (I took out the animation stuff as I did not need it for my testing.)

    $(document).ready(function() {
    var pageContent = “”;

    //Click and Hover events for thumbnail list
    $(“.menu ul li:first”).addClass(‘active’);
    $(“.menu ul li”).click(function(){

    //Set Variables
    var urlPage = $(this).find(‘a’).attr(“href”); //Get Main page URL
    var urlTitle = $(this).find(‘h2′).html();
    var urlDesc = $(this).find(‘.block’).html(); //Get HTML of block
    var urlDescHeight = $(“.contents_page”).find(‘.block’).height(); //Calculate height of block

    if ($(this).is(“.active”)) { //If it’s already active, then…
    return false; // Don’t click through
    } else {
    if (urlTitle == ‘Home’) {
    pageContent = ‘.flashinsert’;// the class name where I want the flash

    }
    $(“.contents_page span”).load(urlPage+pageContent); //load the section into a

    }

    $(“.menu ul li”).removeClass(‘active’); //Remove class of ‘active’ on all lists
    $(this).addClass(‘active’); //add class of ‘active’ on this list only
    return false;

    }) .hover(function(){
    $(this).addClass(‘hover’);
    }, function() {
    $(this).removeClass(‘hover’);
    });

    //Toggle Teaser
    $(“a.collapse”).click(function(){
    $(“.contents_page .block”).slideToggle();
    $(“a.collapse”).toggleClass(“show”);
    });

    });//Close Function

    in the CSS i put the following

    .flashinsert {
    position: relative; /*–Declare X and Y axis base–*/
    /*border: 2px red solid;*/
    left: 0px;
    top: 0px;
    width: 766px;
    }

    I hope it helps. I found the code for the flash works for both IE and FF

    cheers

  305. dupledge on April 22nd, 2010

    rafal

    the html file did not display I shall try again

    flash html file

    Main html file create a element where you want to load the flash

    I hope it works this time

  306. dupledge on April 22nd, 2010

    how do I submit html code for people to view

  307. Steven Snell on April 22nd, 2010

    Dupledge,
    I’d recommend using http://pastie.org/ and then place a link to your pastie here in the comments.

  308. Jake Knight on April 22nd, 2010

    This is my second attempt at using this check it out.

    http://macbeth.wkdesignstudio.com/index.htm#

    The first is at http://www.wkdesignstudio.com

    Let me know what you think.

  309. Nikola on April 25th, 2010

    how can i integrate this script in drupal cms?

  310. [...] to Create an Image Rotator with jQuery and CSS Link [...]

  311. Boldis Media on April 28th, 2010

    Indeed, this is very useful tuorial for our programmer!

  312. dupledge on April 29th, 2010

    I use this demo to load files into the span however I cannot get it to load from a link in the page that gets loaded. For example when you click my “products” btton it loads a section of the “products.html” file into the span. Now when I click a link in this load portion the page it refers to breaks out into a new tab or window. I would like this page to load (and overwrite) the existing content in the span. Any ideas?

  313. Ralph on May 2nd, 2010

    I could not make this script work, someone could send me the files to analyze?

    magazinecds at gmail.com

    Thank You!

  314. Keato on May 3rd, 2010

    Im having issues with IE when viewing the image thumbs, the thumbs will drop below the rotator. When I view it in Safari and Firefox it works perfectly can someone please tell me what im missing.

  315. dupledge on May 3rd, 2010

    Guys
    thanks for the great tutorial. I have used this as the basis for a new website that has text, images and flash. I have managed to get the script to do the following if anyone is interested.

    load images (already did)
    load files (or fragments)
    load swf’s (when needed)

    The site also uses NYROModal for image effects
    the site also lets your links work

    Have a look and let me know what you think

    http://www.kitsheds.com.au:9100/sidach_jd/

    this is only a test site and I need to get the following working

    1. change menu context depending on link clicked (eg show products menu if products clicked)

    I hope it helps. I am not a coder but am having fun thanks to your script

    Cheers

  316. Carlitos on May 4th, 2010

    Hey nice tuto, I asking you permission to write a wordpress plugin for my blog and for the wordpress comunity using this jquery rotator, I will give you the rights of desing, of course only if you let me use it I will do it.

    Ok thannks.

  317. Steven Snell on May 4th, 2010

    Carlitos,
    You would have to check with Soh Tanaka, the author of the tutorial.

  318. [...] Image Rotator with Description (CSS/jQuery) [...]

  319. 男婚女嫁 on May 6th, 2010

    it’s good~~

  320. mark on May 7th, 2010

    Is there any way to disable the “desc” div and the hide/close button for the 2nd and 3rd thumbnails and only have the description for the first thumbnail. My thumbs are related to the first image and I only want a description on the first image.

  321. [...] 3. Create an Image Rotator with Description (CSS/jQuery) [...]

  322. Hacer una Web on May 19th, 2010

    Awesome work.

    Thanks a lot.

  323. Todd on May 22nd, 2010

    Anyone else having issues running this with jQuery 1.4.2 ?

    Initially got the standard “$ is not a function” error, so added

    jQuery.noConflict();

    … but still getting the same error. I intend to through this onto a Magento store, which is rife with issues with Scripatculous reverse integration, so wanted something very clean that degrades well.

    However, I currently can’t get it running locally on 1.4.2.

    Cheers,
    Todd

  324. Todd on May 22nd, 2010

    Sorry guys, ignore me, has been a long day. Implemented noConflict() but forgot to change all the “$’s” to “jQuery” in the js. Brainfreeze!

  325. Todd on May 22nd, 2010

    btw – I am using the above as a starting point for a fully user-managed integrated slider. PHP/MySQL back-end, passing XML into the above so my users can manage what is appearing in the slider, and load-up specials etc… Active/Inactive flags, Ordered Lists, Transition Effect etc…

    It will be skinned very specifically for a single usage, but if anyone wants the source for their own use, then get in touch.

    Should be done in a few days.

  326. [...] Rotação de Imagens com Descrição (CSS/jQuery) [...]

  327. Mihir on May 26th, 2010

    good wp jq hack :)
    tx

  328. Hevyweb on May 26th, 2010

    To complicated!:(

  329. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  330. davetiye on June 5th, 2010

    thank you wey much

  331. Rob on June 8th, 2010

    Hi Soh,

    Can this CSS/JQuery image gallery be used with a number of different transitions? For instance, someone above mentioned using automated fades…could a person use slides? For instance…images automatically sliding from top down or left to right…etc.?

    Is this possible? Also, let’s say I only wanted 4 description panes on the right instead of 6….can this be changed easily? In other words, is this a fully customizeable gallery where size, descriptions, colors of fonts, etc. can be easily changed?

    Thanks,
    Rob

  332. calcio on June 9th, 2010

    Thanks a lot. It’s so cool.

    But one thing, for IE6.

    ‘div.desc’ goes out of the ‘div.main_image’, and it set under the ‘div.main_image’.

    I tried to add some code in CSS for IE6, like ‘margin-right:-3px;’, ‘display:inline;’, or add extra blank div etc., but not success.

    IE8 and IE7 are no problem, only IE6!!

    If someone know how to correct it, please let me know.

    Thanks in advance.

  333. Mohammad on June 9th, 2010

    Thank you very Much … I’ll use it

  334. 123doing on June 10th, 2010

    It’s very good.
    I like this.
    Thanks for share.
    And I wrote something to introduce this project for my readers.
    You can find the post about this in my website.
    If something is wrong,pls figure it out.thanks.

  335. Wandtattoo on June 12th, 2010

    Thank you very Much for this great content We will use it a.s.a.p.

  336. senthilvelan on June 15th, 2010

    Hi this one is great, but in hide/show example how defalutly hide the content and shown only show button clicking this will show the content.

    can anyone guide me Please.

    Thanks in advance.

  337. FireRoxy on June 16th, 2010

    Great tutorial and awesome slider. I love Jquery. thanks for the post.

  338. unique on June 19th, 2010

    I couldn’t get it work. Where am I going wrong?

  339. Mel on June 21st, 2010

    Awesome tutorial just what I needed for a website I’m working on but I need to know if I could change the image sizes and if so could someone please explain how

    Thanks

  340. JB on June 25th, 2010

    Works fine for me in IE6 :)

  341. Vacations in India on June 26th, 2010

    hey ! thts great guide
    will try on my blog soon

    thanks

  342. SEO Divers on June 26th, 2010

    Definitely using this in our next project! Thanks

  343. Virtulian on June 30th, 2010

    Hi
    I am new in css/jquery, this article is very good for me in case of css and jquery knowledge, please share like this article.

    Thanks again

  344. Rafal on July 3rd, 2010

    dupledge
    Thanks for the flash code. In fact im struggling with proper implementing it, so if you are willing to explain it more I will be very gratefull :) The effect I want to achieve is to flip between jpg’s and flash files that are in the same, main tag

  345. Dupledge on July 3rd, 2010

    Rafal

    contact me directly via my email address

    johnadenney at bigpond dot com and I will walk you through what I did

    cheers

    dupledge

  346. Den on July 6th, 2010

    A very nice image rotator!! thanks alot for the tutorial :D

    greetz

  347. Micah Boswell on July 6th, 2010

    I need some guidance here. Based on what I’ve seen in here, I’ve created a slideshow i’m very happy with.

    I’ve run into what I think is a very simple fix, but I don’t know what it is!

    Can you help me integrate this:

    http://bit.ly/cFQ8J4

    into the slider zone here?

    http://bit.ly/bZg1RS

    I know for a fact that what I’m getting are conflicting CSS styles. How do I call a separate stylesheet JUST for the jquery slideshow?

    Thanks in advance!

  348. woiweb on July 8th, 2010

    it’s so easy to use, very well.

  349. Mithun PAL on July 8th, 2010

    How Can i MAKE THE IMAGE SLIDE SHOW AS I CLICK ON NEXT BUTTON
    THE NEXT IMAGE WILL BE SHOWN

  350. [...] Image Rotator (3 kB) Open in new window [...]

  351. [...] Create an Image Rotator with Description (CSS/jQuery) A great tutorial on how to create an image rotator/gallery using CSS and jQuery. It creates a clean UI for displaying a portfolio or general image gallery. [...]

  352. Raghib suleman on July 14th, 2010

    Creating an Image Rotator: Thanks for sharing Dear
    http://www.raghibsuleman.com/jquery-image-rotator-teaser

  353. [...] help you understand how the image rotator works and helps you create your own from scratch. site : visit demo : [...]

  354. Remonty on July 15th, 2010

    A big piece of good work. Thanks for help on this gallery rotator. Keep up the good work!

  355. psdlance on July 16th, 2010

    yeah this is a great tutorial. Tanaka always provides good stuff, especially on his site. I’ve implemented a lot of his tutorials in some of my projects. Its just good quality stuff.

  356. kai on July 19th, 2010

    oke tha’t great … i wanna this app…

  357. [...] Create an Image Rotator with Description (CSS/jQuery) [...]

  358. Ted Robinson on July 21st, 2010

    Over a year later and this tutorial keeps on giving!… here is my variation on it, and a big thank you to Soh.

    http://www.tedrosrobinson.com/work.html

  359. Laura on July 21st, 2010

    Ted, very cool implementation. Do you preload your images? There seems to be a slight delay to show the larger image when first clicking on a thumbnail image.

  360. Ted Robinson on July 22nd, 2010

    I sure don’t have a preloader… Thanks Laura, I knew I forgot something :) And thank you for the kind words.

  361. vuitton hanbags on July 23rd, 2010

    An image rotator is one great way to display portfolio pieces, eCommerce product images, or even as an image gallery. Although there are many great plugins already, this tutorial will help you understand how the image rotator works and helps you create…

  362. wendy's replica on July 27th, 2010

    wow

  363. Sems on July 31st, 2010

    Hello

    I browsed all comments for a working solution for automatic rotation. I tried all solutions given, but none seems to work. Did someone have a working one for me, please?

    Thanks!

  364. suhas on August 3rd, 2010

    too bad idea, there are may way to do this in simple ,5-6 lines of code only.

  365. javier murillo on August 3rd, 2010

    omg,i love it !!

  366. Sems on August 4th, 2010

    @suhas,

    Can you post that code then of yours, please?

    Thanks!

  367. maik on August 5th, 2010

    maybe someone can upload the source code? So the “plugin” as a zip?? thanks!

  368. smita on August 6th, 2010

    I actually was looking out for this code since long…

    Thanks for putting up such great resource :)

    Many thanks
    Smita

  369. Chuse on August 6th, 2010

    ¡ Magnífico !

  370. stefan on August 8th, 2010

    nice plugin!

    you might wanna change your demo-filenames though…
    Safari AdBlock keeps the images from loading!

  371. lv on August 10th, 2010

    Definitely using this in our next project! Thanks

  372. Shubham on August 21st, 2010

    hey, thanks for the tutorial…I implemented it to one of my clients….he loved it ;-) . But the problem with the image rotator was that once we click on another tab it fades in and fades out the same image for a second and then load the next image in the rotator(happens only first time when the tab is clicked). Well any idea’s how to get it fixed?

  373. Jon Paul on August 22nd, 2010

    how do i add small image to the Description text, i have tryed to do this but the image changes to the background image i need a different image in the Description area then the backgrund image. Can anyone help Thank you

  374. anadikt on August 25th, 2010

    Thank you very Much for this great content

  375. Edd Tillen on August 27th, 2010

    I only heard of jquery for the first time yesterday, and don’t really know how to use javascript really, but I still managed to follow this tutorial, it’s dead easy. Thanks so much, Soh, and every one else who provided bits of code. I haven’t finished yet, so I’ll post a link when I have, but I’m well on my way thanks to this.

    One thing, and I think it’s been asked before but not answered. Is there anyway to have the main image change when you hover over the thumbnail, instead of clicking. Like on the BBC image rotator (on the home page as well as the Radio 1 link above).

    In my simple head I’m trying to imaging it’s a case of putting the .hover(function()statement somewhere above the animation code. It’s obviously not that simple, else I would have done it, but I don’t imagine it is that complicated either. Any ideas?

  376. jesudas on August 28th, 2010

    Not able to see other main and image when on click.. can give full zip for download..

  377. Damir on August 28th, 2010

    Hello,

    I can’t find anything about license for this great Image rotator. Can you tell me how can I use rotator? Thanks!

  378. Lucas on August 30th, 2010

    Great Thanks

  379. Vincent on August 31st, 2010

    Cheers for this awesome tutorial! One thing I would like to add is that currently in this version the content for the first item must be duplicated: once in the main_image Section html and then once again as the first list item under the image_thumb Section html.

    If you would prefer to only have to enter the html content once here is a solution. Add this to your javascript before all other javascript:

    jQuery(function(){
    $itemOne = $(‘.image_thumb > ul > li > div:first’).clone();
    $(‘.main_image > div > div’).replaceWith($itemOne);
    });

    In doing so the content contained within your image_thumb Section html will replace the default loaded content. This also means you can insert a fallback message into your main_image Section html for users who have javascript turned off.

    I hope this is helpful to someone out there.

  380. Bruno Monteiro on September 1st, 2010

    To auto-play slides, it works for me:

    $(document).ready(function() {
    $(“.main_image .desc”).show(); //Show Banner
    $(“.main_image .block”).animate({ opacity: 0.65 }, 1 ); $(“.image_thumb ul li:first”).addClass(‘active’); //runs function on click
    $(“.image_thumb ul li”).click(function () {
    var imgAlt = $(this).find(‘img’).attr(“alt”);
    var imgTitle = $(this).find(‘a’).attr(“href”);
    var imgDesc = $(this).find(‘.block’).html();
    var imgDescHeight = $(“.main_image”).find(‘.block’).height();

    if ($(this).is(“.active”)) {
    return false;
    } else {
    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: 0 }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt});
    });
    }

    $(“.image_thumb ul li”).removeClass(‘active’);
    $(this).addClass(‘active’);
    return false;$active = $(this);
    slideSwitchClick();
    })
    .hover(function(){

    $(this).addClass(‘hover’);
    clearInterval(playSlideshow);
    playSlideshow = setInterval(’slideSwitchTimed()’, 7000 );
    }, function() {
    $(this).removeClass(‘hover’);
    });

    //runs function, set timer here
    $(function() {
    playSlideshow = setInterval(’slideSwitchTimed()’, 7000 );
    });
    });

    function slideSwitchTimed() {
    $active = $(‘.image_thumb ul li.active’).next();
    if ( $active.length == 0 ) $active = $(‘.image_thumb ul li:first’);
    slideSwitch();
    }

    function slideSwitchClick() {
    slideSwitch();
    }

    function slideSwitch() {
    var $prev = $(‘.image_thumb ul li.active’);

    //Show active list-item
    $prev.removeClass(‘active’);
    $active.addClass(‘active’);

    //Set Variables
    var imgAlt = $active.find(‘img’).attr(“alt”);
    var imgTitle = $active.find(‘a’).attr(“rel”);
    var imgDesc = $active.find(‘.block’).html();
    var imgDescHeight = $(“.main_image”).find(‘.block’).height();

    if ($(this).is(“.active”)) {
    return false;
    } else {

    $(“.main_image img”).animate({ opacity: 0}, 250 );
    $(“.main_image .block”).animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(“.main_image .block”).html(imgDesc).animate({ opacity: 0.85, marginBottom: 0 }, 250 );
    $(“.main_image img”).attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
    });
    }
    return false;
    }

    Note: replace all the “, and ‘.