Theme park: a ride in the carousel

Last modified: April 6, 2009 - 12:44

If you don't like the look of Jcarousel, it's easy to change using CSS.

The Jcarousel plug-in comes with two built-in skins:

  • IE7
  • Tango

In this how-to we will take the "tango" skin and make some small improvements to it. A common request is to resize the carousel, making it larger.


Let's start

Open this folder "drupal\sites\all\modules\jcarousel_block\jcarousel\skins".

Make a copy of the tango folder and give it a new name. In this example, we will call it "doomed'' .
Run your favorite HTML/CSS editor and load the file "skin.css" from that new folder.

Replace everything in that file with the code below and save the file.

Go to your Drupal Administration / Site Configuration / Jcarousel block ( http://example.com/admin/settings/jcarousel_block ) and at the bottom of the page, change "skin to use:" to "doomed".

The CSS file

/* Based on tango skin - small modifications only - IAR march 2009 */

.jcarousel-skin-doomed .jcarousel-container {
    -moz-border-radius: 10px;
    background: #F0F6F9;
    border: 1px solid #346F97;
}

/* Size of the carousel, as a whole: */
.jcarousel-skin-doomed .jcarousel-container-horizontal {
    width: 400px; /* original value 245 - modified by IAR */
    padding: 20px 40px;
}

.jcarousel-skin-doomed .jcarousel-container-vertical {
    width: 75px;
    height: 245px;
    padding: 40px 20px;
}

/* Area where the thumbnails go into: */
.jcarousel-skin-doomed .jcarousel-clip-horizontal {
    width:  400px; /* original value 245 - modified by IAR */
    height: 90px; /* original value 75 - modified by IAR */
}

.jcarousel-skin-doomed .jcarousel-clip-vertical {
    width:  75px;
    height: 245px;
}

/* Actual space reserved for each thumbnail: */
.jcarousel-skin-doomed .jcarousel-item {
    width: 100px; /* original value 75 - modified by IAR */
    height: 90px; /* original value 75 - modified by IAR */
}

/* Space between thumbnails: */
.jcarousel-skin-doomed .jcarousel-item-horizontal {
    margin-right: 20px; /* original value 10 - modified by IAR */
}

.jcarousel-skin-doomed .jcarousel-item-vertical {
    margin-bottom: 10px;
}

.jcarousel-skin-doomed .jcarousel-item-placeholder {
    background: #fff;
    color: #000;
}

/**
*  Horizontal Buttons
*/
.jcarousel-skin-doomed .jcarousel-next-horizontal {
    position: absolute;
    top: 43px;
    right: 5px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    background: transparent url(next-horizontal.png) no-repeat 0 0;
}

.jcarousel-skin-doomed .jcarousel-next-horizontal:hover {
    background-position: -32px 0;
}

.jcarousel-skin-doomed .jcarousel-next-horizontal:active {
    background-position: -64px 0;
}

.jcarousel-skin-doomed .jcarousel-next-disabled-horizontal,
.jcarousel-skin-doomed .jcarousel-next-disabled-horizontal:hover,
.jcarousel-skin-doomed .jcarousel-next-disabled-horizontal:active {
    cursor: default;
    background-position: -96px 0;
}

.jcarousel-skin-doomed .jcarousel-prev-horizontal {
    position: absolute;
    top: 43px;
    left: 5px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    background: transparent url(prev-horizontal.png) no-repeat 0 0;
}

.jcarousel-skin-doomed .jcarousel-prev-horizontal:hover {
    background-position: -32px 0;
}

.jcarousel-skin-doomed .jcarousel-prev-horizontal:active {
    background-position: -64px 0;
}

.jcarousel-skin-doomed .jcarousel-prev-disabled-horizontal,
.jcarousel-skin-doomed .jcarousel-prev-disabled-horizontal:hover,
.jcarousel-skin-doomed .jcarousel-prev-disabled-horizontal:active {
    cursor: default;
    background-position: -96px 0;
}

/**
*  Vertical Buttons
*/
.jcarousel-skin-doomed .jcarousel-next-vertical {
    position: absolute;
    bottom: 5px;
    left: 43px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    background: transparent url(next-vertical.png) no-repeat 0 0;
}

.jcarousel-skin-doomed .jcarousel-next-vertical:hover {
    background-position: 0 -32px;
}

.jcarousel-skin-doomed .jcarousel-next-vertical:active {
    background-position: 0 -64px;
}

.jcarousel-skin-doomed .jcarousel-next-disabled-vertical,
.jcarousel-skin-doomed .jcarousel-next-disabled-vertical:hover,
.jcarousel-skin-doomed .jcarousel-next-disabled-vertical:active {
    cursor: default;
    background-position: 0 -96px;
}

.jcarousel-skin-doomed .jcarousel-prev-vertical {
    position: absolute;
    top: 5px;
    left: 43px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    background: transparent url(prev-vertical.png) no-repeat 0 0;
}

.jcarousel-skin-doomed .jcarousel-prev-vertical:hover {
    background-position: 0 -32px;
}

.jcarousel-skin-doomed .jcarousel-prev-vertical:active {
    background-position: 0 -64px;
}

.jcarousel-skin-doomed .jcarousel-prev-disabled-vertical,
.jcarousel-skin-doomed .jcarousel-prev-disabled-vertical:hover,
.jcarousel-skin-doomed .jcarousel-prev-disabled-vertical:active {
    cursor: default;
    background-position: 0 -96px;
}


The modifications are commented, to help you understand what was changed.

Before and After:

Here's a screenshot with both the original and the modified carousel - http://img9.imageshack.us/my.php?image=jcarouselblockbeforeand.png

The theme in the screenshot is Efficient from www.themesnap.com but this also works well with Bluemarine and Garland.

 
 

Drupal is a registered trademark of Dries Buytaert.