views:

75

answers:

1

Here's to hoping this makes sense.

I'm testing a new version of my personal site at http://joshuacody.net/jc3/

I'm looking to display my works in a bit of an interactive style, using jQuery.

You can see that each image is mis-matched, but it has a rotator. And you can rotate each image to line all three up. When all three are lined up, I would like to fadeIn a div explaining what that project is.

I'm using the plugin to rotate through my images (http://www.malsup.com/jquery/cycle/), if that's any help.

I'm pretty new to jQuery, and I'm just a hair stuck on how to do this theoretically. Any ideas?

+1  A: 

I went to your site before reading your question and as much as I enjoy playing with the spin feature to line up images, as an interface to actually go somewhere it's non-obvious without reading your explanation.

You'll need to use events or callbacks as described in the demo. The after: parameter is all you really need. I would first fill in your alt attributes with descriptions that are identical for all the slot images that match. Then the after function would look something like:

$('#slot_1').cycle({
 fx: 'scrollVert',
 next: '.scroll_up_1',
 prev: '.scroll_down_1',
 after: onAfter,
 timeout: 0
}); // Duplicate the after param on all 3 slots.
function onAfter(){
 var alt =  $('#slot_1 img:visible').attr('alt');
 if (alt == $('#slot_2 img:visible').attr('alt') &&
     alt == $('#slot_3 img:visible').attr('alt') ) {
  switch (alt) {
  case 'Critical Reason?':
   $('#linkToWork1').click(); //a hidden link?
  break;
  case 'CFCC Labs':
   document.location = 'http://url/to/work/2';
  break;
  case 'Tailgate':
   $('#formActionWork3').submit();
  break;
  default:
  //oops.
  }
 }
}

Note that I put in three ways to actually change the page, you'll probably want to pick your favorite.

dlamblin
Thanks, diamblin. Do you think showing one of the pairs of arrows would be sufficient for letting the user know to tinker with it? Perhaps fading those in on page load? Should I abandon it altogether?Whatever I choose to do with it, I'd still love to explore the problem for the sake of understanding.
Joshua Cody
dlamblin
Great ideas. I've got some sketching and designing to do to implement this, but I'll try and get it done tomorrow.Your solution looks great in theory, and I'll be sure to be back here with much gratitude, as well as clicks of the checkmark and up-arrows.
Joshua Cody
I agree about the interface being a nice idea but, unfortunately, very unintuitive. Perhaps you could have a simple "next project" button which simply causes the images to rotate quickly like a fruit machine, and then stops with them all aligned?
wheresrhys
Suggestions implemented, and I think I have something that's working pretty well for me right now. Thanks so much for all of your help.
Joshua Cody
Cool it looks quite nice; Too bad I had an extra parenthesis in my sample, that's fixed. Also I realized now that my suggestion of 1/2 step items wouldn't animate correctly.
dlamblin