1. $(document).ready(function(){
  2.  
  3. //slideshow transition type - all transition types included with jquery cycle will work
  4. var transition = 'fade';
  5. //turn the pan's negative if you'd like to transition the other way
  6. var pan_x = -30;
  7. var pan_y = -150;
  8. //# of seconds between fades
  9. var fadeDisplayTime = 7
  10. //# of seconds it takes to pan on the x/y axis
  11. var pan_x_time = 7
  12. var pan_y_time = 7
  13.  
  14. $("#menu a").blend();
  15.  
  16.  
  17. //-------------- begin cycle plugin with panning effect
  18. $.fn.getXdir = function (){
  19. return ( $(this).hasClass("panLeft") ) ? 1 : -1;
  20. }
  21. $.fn.getYdir = function (){
  22. return ( $(this).hasClass("panDown") ) ? 1 : -1;
  23. }
  24. $.fn.initSlidePos = function ( x, y ){
  25. //Set x
  26. if( $(this).getXdir() < 0 ) {
  27. $(this).css({ left: 0 });
  28. } else {
  29. $(this).css({ left: (x * $(this).getXdir() ) });
  30. }
  31.  
  32. //Set y
  33. if( $(this).getYdir() < 0 ) {
  34. $(this).css({ top: 0 });
  35. }else{
  36. $(this).css({ top: ( y * $(this).getYdir() ) });
  37. }
  38.  
  39. return $(this);
  40. }
  41. var firstTime = true;
  42.  
  43. $('#slides').cycle({
  44. fx: transition,
  45. timeout: (fadeDisplayTime * 1000),
  46. before: function(currSlideElement, nextSlideElement, options, forwardFlag){
  47. var $obj = $(this);
  48.  
  49. if(firstTime){
  50. $obj.initSlidePos( pan_x, pan_y);
  51. firstTime = false;
  52. }
  53.  
  54. setTimeout( function(){
  55. $obj.initSlidePos( pan_x, pan_y );
  56. }, 50);
  57. },
  58. after: function(currSlideElement, nextSlideElement, options, forwardFlag){
  59. var $obj = $(this);
  60.  
  61. if( $obj.getXdir() < 0 ) {
  62. $obj.animate({ left: pan_x },{ duration: (1000 * pan_x_time), queue:true });
  63. } else {
  64. $obj.animate({ left: "0" },{ duration:(1000 * pan_x_time), queue:false })
  65. }
  66.  
  67. if( $obj.getYdir() < 0 ) {
  68. $obj.animate({ top: ( pan_y )},{ duration:(1000 * pan_y_time), queue:false })
  69. } else {
  70. $obj.animate({ top: "0" },{ duration:(1000 * pan_y_time), queue:false })
  71. }
  72. }
  73. });
  74. //-------------- end cycle plugin with panning effect
  75. });