CJ Flashy Slide Show 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. As with all our projects, simplicity is the key.

Examples

To get a better idea of what this plugin can accomplish, take a look at the samples below. These are the sample images used for the transitions (A slide show consisting of only two slides).

  • CJ Flashy Slideshow Sample - Original Image A
    Orginal Image A
  • CJ Flashy Slideshow Sample - Original Image B
    Orginal Image B

And here are some examples of the types of effects you can achieve. (Please note, these are just animated GIF's. If you want to see the plugin in action, please use the Online Demo link in the side bar.) The settings used to achieve the effect are included.

  • CJ Flashy Slideshow Sample - Sample Effect 1
    Sample Effect 1
  • CJ Flashy Slideshow Sample - Sample Effect 2
    Sample Effect 2
  • CJ Flashy Slideshow Sample - Sample Effect 3
    Sample Effect 3
  • CJ Flashy Slideshow Sample - Sample Effect 3
    Sample Effect 4

Sample Effect 1 - Settings: [none]
Sample Effect 2 - Settings: { xBlocks: 5, yBlocks: 3, minBlockSize: 5, effect: 'rounded' }
Sample Effect 3 - Settings: { xBlocks: 1, yBlocks: 19, minBlockSize: 0 }
Sample Effect 4 - Settings: { xBlocks: 5, yBlocks: 3, minBlockSize: 100, translucent: true }

The effects will change based on your image size. This is because instead of allowing you to determine the dimensions of the effect blocks, I am allowing to specify the count or the number of blocks going horizontally and vertically. So an effect that works well for one size may look different for another. This is something I'm going to address in the next release.

Requirements

CJ Flashy Slide Show requires JQuery 1.3.2 or greater. It may work with older versions, but it has not been tested with those.

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.cjFlashySlideshow-1.1.0.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-1.3.2.min.js" type="text/javascript"></script>
<script src="jquery-flashy-slideshow-1.1.0.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 pl ugin, 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 withing your web page's <body> section.

<div id="example">
   <img src="image_a.jpg" /><br />
   <img src="image_b.jpg" />
</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

And lastly, to get the slide show started, we need to call the plugin. This is fairly easy, just include the following code in the header section of the web page (be sure it's after you include the previous javascript files.

<script type="text/javascript"><!--
$(function () {
   $(document).ready(function () {
      $('#example').cjFlashySlideShow();
   });
});
//-->
</script>

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

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

Arguments

Argument Description Type Default Op tions
xBlocks The number of blocks horizontally. integer 12 > 0
yBlocks The number of blocks vertically. integer 3 > 0
minBlockSize The initial block size as it enters into the frame, prior to the scale to fill. integer 5 >= 0
delay The delay between tranistions in milliseconds. integer 3000 >= 0
direction Determines which direction the blocks enter the frame from. string left top, left, bottom, right, random, none
style The name of the style type to use. ('rounded' currently uses experimental CSS rules) string normal normal, rounded
translucent Adds a level of transparency to the initial blocks. They will fade to a solid towards the end of the effect. boolean false true, false
sloppy Adds a level of randomness to the block animation. Essentially this will scatter the blocks based on the minBlockSize dimension. boolean false true, false

8 responses to "CJ Flashy Slide Show 1.1"

notjustanotherjones
Can you have 2-3 instances of this on one page?
Doug
Doug responds:
@notjustanotherjones - Yep, you just need to give each item it's own ID. You might be able to use a common class as well, like:

$('.example').cjFlashySlideShow();


You would need to experiment.
notjustanotherjones
I got it to work... For some reason it didn't work the first time though
notjustanotherjones
Is there a way to control the speed of the transition and not the speed between the transitions?
Doug
Doug responds:
@notjustanotherjones - Not at the moment. That would be a good edition for the next version.
Doug
Doug responds:
@notjustanotherjones - I also think I am going to split the "sloppy" setting for both the x and y coordinates.
Haydar
Thanks for your script. This is very useful and nice script.
Doug
Doug responds:
@Haydar - Thanks, glad you like!
monaye
Great plugin. Hope to see something similar for text version.
viki
viki says:
Can this script be used in commercial web-templates for sell and redistribute?
Is there any license or?
Pls e-mail me.
Doug
Doug responds:
@viki - You can click on the "License" button above or if you downloaded the file, you can take a look at the code, there's one in their too. In a nutshell, yes. But there's conditions.
kflorida
Great job! I love jQuery! One problem, this plugin breaks if MooTools is being called on the same page. Particularly in Safari and Chrome.

Any ideas why this conflicts with mootools? Anyway to fix it?
Doug
Doug responds:
@kflorida - Do you have a link I could look at. It might have something to do with "$". "$" can be used by different libraries as shorthand for the function name. It's possible that MooTools is using this as well and it might be interfering with jQuery. This is just a guess.
Doug
Doug responds:
@kflorida - I looked into it a little further.

Instead of trying to initiate cjFlashySlideShow this way:

$(function () {
$(document).ready(function () {
$('#example').cjFlashySlideShow();
});
});

try this way:

jQuery(document).ready(function($){
$('#example').cjFlashySlideShow();
});

Let me know if that works for you.
Freemind
i m using that one
follow all instruction but its not working any help from any one....
Doug
Doug responds:
@Freemind - got a link that I could look at online?

Comments are closed.