CJ Image Flipbox 1.1.1

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.1

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!

Release Notes

This release fixes a minor issue with the way I was calculating the mouse offset. Big thanks goes out to user Debug for pointing this out. Thanks!

4 responses to "CJ Image Flipbox 1.1.1"

Debug
Debug says:
Hi Doug,

Thanks for the 1.1.1 update! Works perfectly!
jminguely
A little problem with a fancybox (or lightbox) integration.
I can't make it both works, fancybox works, but when I activate flipbox, the fancybox don't work any more..

Any idea?

PS: the whole integration is in CMS made Simple
Doug
Doug responds:
@jminguely - Are you getting any errors in the console log? If you have a link, I can take a look.
jminguely
jminguely responds:
@Doug - Here is a sample of code:

<div class="cj_image_flipbox_block">
<div class="cj_image_flipbox_pics">

<a class="light" rel="projet" href="images/projets/007_site/007_site_photo 001.jpg">
<img src="images/projets/007_site/007_site_photo 001_thumb.jpg" alt="" /></a>

<a class="light" rel="projet" href="images/projets/007_site/007_site_photo 002.jpg">
<img src="images/projets/007_site/007_site_photo 002_thumb.jpg" alt="" /></a>

</div>
</div>

with my call:
<InvalidTag src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<InvalidTag src="js/jquery.cj-image-flipbox.js" type="text/javascript"></script>
<InvalidTag type="text/javascript" src="js/jquery.fancybox-1.3.1.js"></script>

<InvalidTag type="text/javascript">


$(function() {
$(document).ready(function() {
// initialize flipbox
$("div.cj_image_flipbox_block").cjImageFlipBox({debug: false});
$('.light').fancybox({
'transitionIn' : 'swing',
'transitionOut' : 'swing',
'speedIn' : 600,
'speedOut' : 200,
'overlayShow' : false
});
});
});

</script>


Is there something wrong?

All the website is on www.dmart.ch/new

Thanks a lots for your jobs!
Doug
Doug responds:
@jminguely - I'll take a look at this today and see if I can tell what's going on.
Doug
Doug responds:
@jminguely - Can you post the CSS you are using for "cj_image_flipbox_block" and "cj_image_flipbox_pics"?
jminguely
jminguely responds:
@Doug - Here is the thing:

/*
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: 240px;
height: 180px;
overflow: hidden;
border: 0;
margin-right: 10px;
margin-bottom: 10px;
}
div.cj_image_flipbox_block br {
display: none;
}

And still thank you for your engagement!
Doug
Doug responds:
@jminguely - Ok, I figured out what was going on.

FancyBox is initiated to look for ".light", which is a list of all the <A> tags. The problem is, my script is actually hiding all the <A> tags and then is creating a new one one which will dynamically change the HREF based on the image that is selected. (If it has a link), if not it sets it to void(0).

I'm not sure if my script can be compatible with fancybox, unless I do a complete re-write changing how the <A>'s are handled.

I tried manually initing fancybox by using javascript in the HREF field, but that didn't work to well. I'll noodle on it for now, but in the meantime, I don't think it's going to work.
jminguely
jminguely responds:
@Doug - Okay, no problem, it can wait :) !

Did you already implement this kind of plugins with the flipbox? Because if it can works with an other similar gallery plugins, it can make the way!

But still a big thanks for your job guy and your very fast answer, that's nice!
Doug
Doug responds:
@jminguely - I've never implemented it with FancyBox the way your doing it... and to be honest I haven't used this plug-in for any projects yet. This was one of my first jQuery plug-ins I made, so it was more of a proof or concept.

I'll think about it for awhile and if I have some free time, I'll rework it. It really shouldn't be that difficult to do what you are trying to do, I just need the free-time.

Thanks for the input!
jminguely
jminguely responds:
@Doug - Okay, just to say you've made a fabulous work with this plugin, it's very attractiv and I think that it's a nice way to integrate a gallery into a website.

So I stay in alert about some update of the project, thanks for your job and thanks for your time of course!

Julien
Thomas
I am loving this - using it in the development of a new community site. How do I make it spring back to the first image once the mouse is not over the images?
Doug
Doug responds:
@Thomas - Take a look at the first couple of comments from the last version...

http://www.cjboco.com/projects.cfm/project/cj-image-flipbox/1.1.0

(It's not in the script since this is supposed to mimic what Apple does with iPhoto)
Thomas
Thomas responds:
@Doug - Perfect - thanks a lot
Thomas
How do I get the original alt text from each image? For SEO purposes it it not good to have "CJ Image slides" all over the site.

Have something to say? Leave a comment!

You don't have to be registered to leave a comment. Unregistered user's comments will be approved before going live.




You are currently posting as an unregistered user.
This means that your comment will be reviewed prior to going live. If you are a registered user, please . New user? No problem, register for an account, it's FREE! Benefits include, posting instantly, screen name protection, collaboration recognition, subscribe to article updates, and so much more!