Circular Content Carousel with jQuery

Today we want to share a simple circular content carousel with you. The idea is to have some content boxes that we can slide infinitely (circular). When clicking on the “more” link, the respective item moves to the left and a content area will slide out. Now we can navigate through the carousel where each step will reveal the next or previous content box with its expanded content. Clicking on the closing cross will slide the expanded content area back in and animate the item to its original position.

Today we want to share a simple circular content carousel with you. The idea is to have some content boxes that we can slide infinitely (circular). When clicking on the “more” link, the respective item moves to the left and a content area will slide out. Now we can navigate through the carousel where each step will reveal the next or previous content box with its expanded content. Clicking on the closing cross will slide the expanded content area back in and animate the item to its original position.

The beautiful animal icon set in the ZIP file are by Cyberella and they are licensed under the Attribution-NonCommercial-NoDerivs 3.0 Unported (CC BY-NC-ND 3.0) License.

The HTML Structure

The structure consists of a main container and a wrapper for the items. Each item contains

<div id="ca-container" class="ca-container">
	<div class="ca-wrapper">
		<div class="ca-item ca-item-1">
			<div class="ca-item-main">
				<div class="ca-icon"></div>
				<h3>Stop factory farming</h3>
				<h4>
					<span class="ca-quote">“</span>
					<span>Some text...</span>
				</h4>
					<a href="#" class="ca-more">more...</a>
			</div>
			<div class="ca-content-wrapper">
				<div class="ca-content">
					<h6>Animals are not commodities</h6>
					<a href="#" class="ca-close">close</a>
					<div class="ca-content-text">
						<p>Some more text...</p>
					</div>
					<ul>
						<li><a href="#">Read more</a></li>
						<li><a href="#">Share this</a></li>
						<li><a href="#">Become a member</a></li>
						<li><a href="#">Donate</a></li>
					</ul>
				</div>
			</div>
		</div>
		<div class="ca-item ca-item-2">
			...
		</div>
		...
	</div><!-- ca-wrapper -->
</div><!-- ca-container -->	

The initial view of the content carousel:

When we click on “more…”, another content area will slide out and move the respective item to the left:

The default options are the following:

$('#ca-container').contentcarousel({
	// speed for the sliding animation
	sliderSpeed		: 500,
	// easing for the sliding animation
	sliderEasing	: 'easeOutExpo',
	// speed for the item animation (open / close)
	itemSpeed		: 500,
	// easing for the item animation (open / close)
	itemEasing		: 'easeOutExpo',
	// number of items to scroll at a time
	scroll			: 1	
});

We hope you enjoy this simple carousel and find it useful!

Tagged with:

Manoela Ilic

Manoela is the main tinkerer at Codrops. With a background in coding and passion for all things design, she creates web experiments and keeps frontend professionals informed about the latest trends.

Stay up to date with the latest web design and development news and relevant updates from Codrops.

Feedback 153

Comments are closed.
  1. yet another killer… you are making some serious things to jquery. I think i’m gonna use this in my next template.

  2. But a small bug in IE. its fallback the last slide wrongly. please check the demo again.

  3. There are bugs in this demo. When you open a penel that is not on left most part of slider and then closes it the whole behaviour of slider changes and it starts repeating same slides. Other than that its good.

  4. Hi all, thanks for your feedback!
    @Imran, I cannot recreate the problem that you are describing, please note that the text is repeated throughout the expanded content areas. The headlines are not though, could you check that again?
    @Selva what do you mean with fallback? And what exactly is wrong with it and which IE version are you using? Thanks and cheers, ML

  5. this is just AWESOME!!
    i have no problem in my IE… i’ve just 2 warning error for position left and top with firebug…
    thanks for your great work!

  6. amazing.. and surprisingly, its very simple to implement & light weight on pages…

    does it work across all browsers

  7. i double checked by using IE7,8,9. The problem is in,
    After loading all items just you click on the “more” button of third container (ca-item-main). It opens the content wrapper to its right. Then if you close that wrapper by pressing “X” in the top. Then you see the problem. It doesn’t show the things correctly.

    But besides its a nice one. You did a good job mary lou. πŸ˜€

  8. So streamlined. Great job on the markup. The “card” layout and typography is gorgeous.

  9. I guess one solution to IE problems is to not use IE. Great tutorial, Mary-Lou, as always.

  10. @Selva, I tried in IE7/8/9 and I simply cannot see any problem… A screenshot would be great to see what happens! Thanks and cheers, ML

  11. i create a 3 carousel in one page with different id, all carousel are use the last ca-item quantity, how to fix it?

    • @lalapo Could you download it again and replace the js file? Let me know if it works!

  12. Hi Mary Lou iΒ΄m giving the first steps developing websites,and iΒ΄m learning a lot on this site,My question is can we use the content for building websites for other people??Comercial use?
    Great tutorial.

  13. @marylou

    Looking at the js file.
    where can I change it, so the slide takes over the whole container, sliding the left panel off screen?

    Cheers

  14. Brilliant script!

    I am trying to modify it to show 5 items at once (the whole thing is still 990px wide).

    I can get the 5 items to show fine however I cannot get the “Show More” box to stretch the whole width, it is only going the distance of 3 boxes.

    Is it possible to either have the script auto detect how many are showing or provide a variable/option for how many items you wish to display or even just hint me in the right direction of what needs to be edited?

    Many thanks

  15. I was looking at some point for a circular carousel and I wasn’t happy with what I found. This one looks really good!

    Thumbs up for the content for the slides πŸ˜€

  16. Great carousel!

    Is there any way to adjust is so that instead of having to click the “more” links, a click anywhere on an item will cause it to slide open?

    Thanks,

    Michael

  17. Once Again you never fail to impress, variations of this simple carousel are surely going to start popping up all across the web. The more tab is a nice touch. Keep up the Good work Mary Lou, I look forward to seeing what you come up with next time!

  18. Hi Mary Lou,
    this is impressive.
    Sorry to tell you, i accidently found a bug:once you click the ?read more’ link and the green box with the paragraph text appears, you should disable scrolling and the next/previous button, ’cause wright now if i scroll after a while there is nothing to scroll, every item dissappears. Also, if i close the green box, after scrolling a bit with the box open, after returning all the items are doubled?
    Using latest Chrome version, hope it helps πŸ™‚ Keep it up πŸ™‚

  19. I am loving this! I am a true novice to js and was wondering if there is a way?

    I see that the html for the navigation arrows is contained within the js file.

    Is there a way for me to create a link outside of the js file that when clicked it will slide to a certain slide?

  20. Fluid, easy to use, functional, ergonomic design…
    Good inspiration

    Bonne continuation ML.

  21. @Selva Thank you for recording that! That’s very strange indeed, did anybody else experience that same problem? Cheers, ML

    • Mary I have the same issue like Selva has, it happens only IE9 though, not even IE8.

      Strange, Maybe IE9 has bugs on jQuery code ? While older IE 8 doesn’t have the same problems ?

  22. Hello John Nerush

    I think your suggestion is a good one, we should have an option as to how many items to be shown in the carousel.

    Albeit, here is a temporary solution you seek.

    I tried with 4 items and these are the lines I had to change.

    LINE 12

    factor = 4;

    LINE 54

    width : cache.itemW * 3 + ‘px’,

    LINE 78
    $item.css( ‘left’, – ( openedIdx – idx ) * ( cache.itemW * 4 ) + ‘px’ ).show().find(

    LINE 80
    width : cache.itemW * 3 + ‘px’

    Add the below after LINE 135

    case cache.itemW * 3 : return 4; break;

    And then from LINE 170 to LINE 178

    change all 3’s to 4

    Finally modify

    .ca-container{
    width:980px;
    }
    .ca-item{
    width:245px;
    }

    A little calculations and logical thinking could give you solutions to N number of items.

    Hope this helps!

    Cheers to Mary Lou!

  23. @ML

    What I was wondering is instead of this complex logic (for beginners like myself) couldn’t we just keep the carousel repeating and on click of an item, clone it, animate it to the left, increase the width of the description, make its z-index higher and simply hide the main carousel.

    A simple yet effective solution… what you recon?