A Nice jQuery Plug-In That Mimics Apple's iPhoto App to Display a Group of Images
JQuery Plug-In: CJ Image FlipBox v1.1.0
Apparently I'm a gluten for punishment, because I'm at it again. I done gone and made me another jQuery plug-in. CJ Image FlipBox v1.0 is a jQuery plug-in that displays a series of images based on the mouse position within the display box. The left-most side of the FlipBox displays the first image, where as the right-most side displays the last image. Moving between the two, displays any other images that fall between. This is an attempt to mimic Apple's iPhoto software and the way it displays events. As an added bonus, I actually took the time and tested it in the following browsers: FireFox 3.5, IE6, IE7, IE8, Safari 4. (Lesson learned from my first jQuery Plug-In!)
I made this plug-in initially for a few e-Commerce sites I'm working on. It's a nice way to display multiple images for a product, but I think it has other uses as well. I'll leave that up to you to discover on your own. So hit up the following download links and grab yourself a copy today!
Example Usage
I tried to keep things a simple as possible. Basically you just need to create one or more FlipBoxes that contain a series of images. The Plug-In can handle multiple FlipBoxes with any number of images inside. I would gather that the only real limit is the strain you will put on the user for downloading the page. (i.e. a lot of large images my take some time). All you need to do is create some <div> blocks that have some images within like this:
<div class="cj_image_flipbox_block">
<div class="cj_image_flipbox_pics">
<img src="my_image_01.jpg" alt="Image 1" width="180" height="240" /><br />
<img src="my_image_02.jpg" alt="Image 2" width="180" height="240" /><br />
<img src="my_image_03.jpg" alt="Image 3" width="180" height="240" /><br />
<img src="my_image_04.jpg" alt="Image 4" width="180" height="240" /><br />
<img src="my_image_05.jpg" alt="Image 5" width="180" height="240" />
</div>
</div>
To initiate everything, you need to call the Image FlipBox plug-in like so:
$("div.cj_image_flipbox_block").cjImageFlipBox({});
The CSS is simple as well. There really only one element we need to style and that's the class cj_image_flipbox_block. The other div (cj_image_flipbox_pics) is used by the plug-in to find the images. I made it this way in case you wanted to add another element to the block (like a caption or title). Here's a basic example of the CSS I used on the demo page:
/*
styles for cj image flipbox
----------------------------------*/
div.cj_image_flipbox { display: block; width: 100%; height: auto; }
div.cj_image_flipbox_block { position: relative; display: block; width: 180px; height: 240px; overflow: hidden; border: 2px solid #000; margin-right: 10px; margin-bottom: 10px; float: left; }
div.cj_image_flipbox_block br { display: none; }
That's about as simple as you can get, right? If you would like to see it in action, check out the demo page. And as always, if you have any problems or question, be sure to let me know. My sole reason for existance is to make you happy!
9 responses to "CJ Image Flipbox 1.1"
-Joe
$(sys.elem).mouseout(function (e) {
var self = this;
$(self).find("div.cj_image_flipbox_pics img.cj_image_flipbox_img").attr({
"src": self.imgs[0].src
});
});
That should do the trick. You could either add this right after the $(sys.elem).mousemove block, or add the mouseout event to that block.
Hope this helps. Let me know if that's confusing.
worked like a champ! Thanks...I just had to be very selective as to where to place the code...other than that thanks a ton!
Can i send it somewhere if you wanna take a look at it?
I'll take a look at it, Thank!
It's me again, from a long time ago...I have your image flip box working great, but wanted to see if a few features were possible.
What I am trying to accomplish is to have a different hyperlink associated with each image that flips through. In some instances it works, but others it doesn't. Please help!
-Joe
works out of the box.
but as soon as I try to center the wrapper within the page, things start to get buggy...
here's the demo:
http://www.zueriwest.ch/demo/flipbook_1/
as soon as I put margins and paddings to the wrapper it won't work...
do you know what could cause this?
thanks for sharing your plugins!
respect!
stefan
Regards... and thank you,
AiZ
try this way:
I was wondering if there was a parameter so once the mouse is not over the pictures, it goes back and shows the first one instead of keeping the latest picture showed.
Thanks!
AiZ
Great script. I'm just having a little trouble with the flipbox in a centred div. Turning on the debug I've noticed that the x and y values are relative to the entire page, rather than just the image. Do you know if there is a way for me to adjust this?
Here's an example of my problem.
Any help would be greatly appreciated.
http://flipbox.jamesjohnston.net/debug.html
Thanks