Creative Juices Bo. Co.

Satisfy Your Thirst For Something Refreshing!

CJ Flashy Slide Show 2.1.1

A JQuery Plugin That Gives Your Slide Shows Some Flash-Like Transitions

Project Description

CJ Flashy Slide Show is a JQuery plugin that allows you to create a photo slide show that has some "flash-like" transitional effects. The plugin has various settings which you can manipulate to achieve a multitude of effects, such as sizing, timing, transparency and shape style. Integration is a snap, you basically create a set of images and wrap it within a simple container. Unlike most Flash solutions you do not need to create an external XML file or embed your images within a hard-to-change Flash project.

This version fixes various issues reported by users as well as incorporating a few new features. I've also rewrote the plug-in to incorporate a brand new framework which should be more compatible with other libraries.

Requirements

CJ Flashy Slide Show requires JQuery 1.7 or greater.

Implementing

Header Includes

Getting CJ Flashy Slide Show to work is really quite simple. The first thing you are going to need to do is include the jquery.cj-flashy-slideshow.js file after your call to include JQuery. This is done in the header area of your web page. Typically you will do something like this:

<script src="jquery-min.js" type="text/javascript"></script>
<script src="jquery.cj-flashy-slideshow.js" type="text/javascript"></script>

Next, you will need to have a block container that contains a single or group of images. I've added line breaks <br> in my example, but it is not neccessary. I do this so the page looks somewhat presentable for any user who may not have a JavaScript or CSS capable web browser.

HTML

An important note about setting the image dimensions. The plugin will basically ignore the image width and height settings. So you need to make sure that your images are scaled and cropped exactly how you want them to display within the container. I might revisit this in a later version of the plug-in, but for now just make sure all your images are the same size.

Here's an example of what a container might look like. This code would be placed somewhere within your web page's <body> section.

<div id="example">
   <img src="image_a.jpg" /><br />
   <img src="image_b.jpg" />
</div>

...or if you would like to have links...

<div id="example">
   <a href="http://www.cjboco.com"><img src="image_a.jpg" /></a><br />
   <a href="http://www.yahoo.com"><img src="image_b.jpg" /></a>
</div>
CSS

We now have to apply some CSS rules to our container. Nothing to fancy or complicated, just a few key elements that are going to be required by the plugin. You need to set the position of the block to either relative or absolute. Also you need to be sure to set the width and the height, as well has making sure that any overflow is hidden. The second rule is not required, but just to be sure, I've hidden all the line-breaks.

div#example {
   position: relative;
   display: block;
   width: 250px;
   height: 150px;
   overflow: hidden; 
}
div#example br { 
   display: none;
}
Initiating the Script

To get the slide show started, with the default preset (bricks) all you have to do is initiate the script like this:

<script>
   (function ($) {
      $('#example').cjFlashySlideShow();
   }(jQuery));
</script>

... or if you want to pass along one of the predefined presets, you would do something like this:

<script>
   (function ($) {
      $('#example').cjFlashySlideShow({
         preset: "cubism"
      });
   }(jQuery));
</script>

Presets

Below is a list of all the currently available presets. If you would like to create additional presets, post what you have in the comments below. I'll gladly give you credit!

PresetDescriptionDefault
bricksCJ Flashy Slide Show - BRICKS preset

Little bricks drop in from the top and expand to reveal the underlying image.
Yes
cubismCJ Flashy Slide Show - BRICKS preset

Random transparent blocks fly in from all sides to reveal the underlying image.
No
rainCJ Flashy Slide Show - BRICKS preset

Small rain drops fall from the top and expand to reveal the underlying image.

*This preset only works in browsers which supports CSS3 rules.
No
blindsCJ Flashy Slide Show - BRICKS preset

Evenly spaced and sized horizontal bands expand to reveal the underlying image.
No
blinds2CJ Flashy Slide Show - BRICKS preset

Evenly spaced and sized vertical bands expand to reveal the underlying image.
No
transportCJ Flashy Slide Show - BRICKS preset

Random transparent horizontal bands expand to reveal the underlying image.
No
transport2CJ Flashy Slide Show - BRICKS preset

Random transparent vertical bands expand to reveal the underlying image.
No

Going Old-School

You don't have to use the built in presets, this plug-in is based off of version 1.1.2 of the plug-in and it still retains the ability to define your own settings. Below is a list of the various options you can pass to the plug-in.

Arguments

ArgumentDescriptionTypeDefaultOptions
xBlocksThe number of blocks horizontally.integer$(element).width() / 100> 0
yBlocksThe number of blocks vertically.integer$(element).height() / 100> 0
minBlockSizeThe initial block size as it enters into the frame, prior to the scale to fill.integer3>= 0
delayThe delay between tranistions in milliseconds.integer3000>= 0
directionDetermines which direction the blocks enter the frame from.stringtoptop, topleft, topright, left, bottom, bottomleft, bottomright, right, random, none
styleThe name of the style type to use. ('rounded' currently uses experimental CSS rules)stringnormalnormal, rounded
translucentAdds a level of transparency to the initial blocks. They will fade to a solid towards the end of the effect.booleanfalsetrue, false
sloppyAdds a level of randomness to the block animation. Essentially this will scatter the blocks based on the minBlockSize dimension.booleanfalsetrue, false

... or if you want to pass along some arguments, it might look something like this:

<script type="text/javascript"><!--
   (function ($) {
      $('#example').cjFlashySlideShow({
         xBlocks: 3,
         yBlocks: 3,
         minBlockSize: 80,
         delay: 1250,
         direction: 'random',
         translucent: true,
         sloppy: true
      });
   }(jQuery));
</script>

Stuff

That's about it. If you run across any issues or if you have ideas for improvements, please let me know. Enjoy!

* Note: If you would like to participate in fixing issues or you have ideas for improvements you can fork this project and others on GitHub.

Release Notes

Version 2.1.1 now requires jQuery 1.7+