Supersized transition effects problem, help meh if u can :)

Supersized transition effects problem, help meh if u can :)

I simply want to change the effect from this silly slide in / slide out to a nice fade but cant get it to work in the .php file of my wordpress template
this is the problem area i think: I would sure appreciate any advise! 

  1. $tf_bg_img_next.css('left',$tf_bg_img.width());
  2. //now slide it to the viewport
  3. $tf_bg_img_next.stop().animate({
  4. left  : 0
  5. },1000);
  6.                                             // I try and replace this with...and nothing :(
  7.                                            $tf_bg_img_next.stop().fadeIn(1000);
  8. $tf_bg_img_next.css('left',-$tf_bg_img.width());
  9. //we want the old image to slide in the same direction, out of the viewport
  10. var slideTo = (dir == 'tb')?$tf_bg_img.width() + 'px':jQuery(window).width() + 'px';
  11. $tf_bg_img.stop().animate({
  12. left  : slideTo
  13. },1000,function(){
  14. //hide it
  15. jQuery(this).hide();
  16. //the $tf_bg_img is now the shown image
  17. $tf_bg_img = $tf_bg_img_next;
  18. //show the description for the new image
  19.    if(jQuery(window).width() < 767){ $tf_content_wrapper.css('padding-top',$tf_bg_img.height()); }
  20. $tf_content_wrapper.children()
  21.    .eq(current)
  22.        .fadeIn(500);
  23. });

  • - FULL CODE -
    1. <script type="text/javascript">
    2. /*
    3. the images preload plugin
    4. */
    5. (function($) {
    6. $.fn.preload = function(options) {
    7. var opts = $.extend({}, $.fn.preload.defaults, options);
    8. o = $.meta ? $.extend({}, opts, this.data()) : opts;
    9. var c = this.length,
    10. l = 0;
    11. return this.each(function() {
    12. var $i = jQuery(this);
    13. jQuery('<img/>').load(function(i){
    14. ++l;
    15. if(l == c) o.onComplete();
    16. }).attr('src',$i.attr('src'));
    17. });
    18. };
    19. $.fn.preload.defaults = {
    20. onComplete : function(){return false;}
    21. };
    22. })(jQuery);
    23. </script>
    24. <script type="text/javascript">
    25. jQuery(function() {
    26. var $tf_bg = jQuery('#tf_bg'),
    27. $tf_bg_images = $tf_bg.find('img'),
    28. $tf_bg_img = $tf_bg_images.eq(0),
    29. total = $tf_bg_images.length,
    30. current = 0,
    31. $tf_content_wrapper = jQuery('#tf_content_wrapper'),
    32. $tf_next = jQuery('#tf_next'),
    33. $tf_prev = jQuery('#tf_prev'),
    34. $tf_loading = jQuery('#tf_loading');
    35. //preload the images
    36. $tf_bg_images.preload({

    37. onComplete : function(){
    38. $tf_loading.hide();
    39. init();
    40. }
    41. });
    42. //shows the first image and initializes events
    43. function init(){
    44. //get dimentions for the image, based on the windows size
    45. var dim = getImageDim($tf_bg_img);
    46. //set the returned values and show the image
    47. $tf_content_wrapper_padding = parseInt($tf_bg_img.css('height'));
    48. $tf_content_wrapper.find('div:not(:first-child)').css('display','none');
    49. if(jQuery(window).width() < 767){ $tf_content_wrapper.css('padding-top',$tf_content_wrapper_padding+'px'); }
    50. $tf_bg_img.css({
    51. width : dim.width,
    52. height : dim.height,
    53. left : dim.left,
    54. //top : dim.top
    55. }).fadeIn();
    56. $tf_content_wrapper.fadeIn();

    57.    
    58. //resizing the window resizes the $tf_bg_img
    59. jQuery(window).bind('resize',function(){
    60. if(jQuery(window).width() > 767){
    61. var dim = getImageDim($tf_bg_img);
    62. $tf_bg_img.css({
    63. width : dim.width,
    64. height : dim.height,
    65. left : dim.left,
    66. //top : dim.top
    67. });
    68. }
    69. else{
    70. jQuery('.full-width-container').css('padding-top','0');
    71. resize($tf_bg_img);
    72. $tf_content_wrapper.css('padding-top',(parseInt($tf_bg_img.css('height'))));

    73. }
    74. });
    75. //expand and fit the image to the screen
    76. jQuery(window).load(function(){
    77.   if(jQuery(window).width() < 767){
    78.   $tf_bg_images.each(function(){
    79.                                resize($tf_bg_img);
    80. });
    81. }
    82. if(jQuery(window).width() > 767){
    83. if($tf_bg_img.is(':animated'))
    84. return false;
    85. var dim = getImageDim($tf_bg_img);

    86. $tf_bg_img.animate({
    87. width : dim.width,
    88. height : dim.height,
    89. //top : dim.top,
    90. left : dim.left
    91. },350);
    92. }
    93. }); 
    94. //click the arrow down, scrolls down
    95. $tf_next.bind('click',function(){
    96. if($tf_bg_img.is(':animated'))
    97. return false;
    98. scroll('tb');
    99. });
    100. //click the arrow up, scrolls up
    101. $tf_prev.bind('click',function(){
    102. if($tf_bg_img.is(':animated'))
    103. return false;
    104. scroll('bt');
    105. });
    106. //key events - down / up button trigger the scroll down / up
    107. jQuery(document).keydown(function(e){
    108. if($tf_bg_img.is(':animated'))
    109. return false;
    110. switch(e.keyCode){
    111. case 37:
    112. scroll('bt');
    113. break;

    114. case 39:
    115. scroll('tb');
    116. break;
    117. }
    118. });
    119. setInterval(function() {
    120. scroll('bt');
    121. }, 5000); 
    122. jQuery(document).swipe( {
    123.  swipeLeft:function(event, direction, distance, duration, fingerCount) {
    124.     scroll('tb');
    125.  },
    126.  swipeRight:function(event, direction, distance, duration, fingerCount) {
    127.     scroll('bt');
    128.  },
    129.  threshold:100
    130. });
    131. }
    132. //show next / prev image
    133. function scroll(dir){
    134. //if dir is "tb" (top -> bottom) increment current, 
    135. //else if "bt" decrement it
    136. current = (dir == 'tb')?current + 1:current - 1;
    137. //we want a circular slideshow, 
    138. //so we need to check the limits of current
    139. if(current == total) current = 0;
    140. else if(current < 0) current = total - 1;
    141. //we get the next image
    142. var $tf_bg_img_next = $tf_bg_images.eq(current),
    143. //its dimentions
    144. dim = getImageDim($tf_bg_img_next),
    145. //the top should be one that makes the image out of the viewport
    146. //the image should be positioned up or down depending on the direction
    147. left = (dir == 'tb')?jQuery(window).width() + 'px':-parseFloat(dim.width,10) + 'px';
    148. //set the returned values and show the next image
    149. $tf_bg_img_next.css({
    150. width : dim.width,
    151. height : dim.height,
    152. left : left,
    153. }).show();

    154. //the top should be one that makes the image out of the viewport
    155. if(jQuery(window).width() < 767){
    156. resize($tf_bg_img_next);
    157. $tf_bg_img_next.css('left',$tf_bg_img.width());
    158. //now slide it to the viewport
    159. $tf_bg_img_next.stop().animate({
    160. left : 0
    161. },1000);
    162. $tf_bg_img_next.css('left',-$tf_bg_img.width());
    163. //we want the old image to slide in the same direction, out of the viewport
    164. var slideTo = (dir == 'tb')?$tf_bg_img.width() + 'px':jQuery(window).width() + 'px';
    165. $tf_bg_img.stop().animate({
    166. left : slideTo
    167. },1000,function(){
    168. //hide it
    169. jQuery(this).hide();
    170. //the $tf_bg_img is now the shown image
    171. $tf_bg_img = $tf_bg_img_next;
    172. //show the description for the new image
    173.   if(jQuery(window).width() < 767){ $tf_content_wrapper.css('padding-top',$tf_bg_img.height()); }
    174. $tf_content_wrapper.children()
    175.   .eq(current)
    176.       .fadeIn(500);
    177. });


    178. //hide the current description
    179. $tf_content_wrapper.children(':visible')
    180.   .hide()
    181. }
    182. //animate the image to fit in the viewport
    183. function resize($img){
    184. var w_w = jQuery(window).width(),
    185. w_h = jQuery(window).height(),
    186. i_w = $img.width(),
    187. i_h = $img.height(),
    188. r_i = i_h / i_w,
    189. new_w,new_h;
    190. if(i_w > i_h){
    191. new_w = w_w;
    192. new_h = w_w * r_i;
    193. if(new_h > w_h){
    194. new_h = w_h;
    195. new_w = w_h / r_i;
    196. }
    197. }
    198. else{
    199. new_h = w_w * r_i;
    200. new_w = w_w;
    201. }
    202. $img.css({
    203. width : new_w + 'px',
    204. height : new_h + 'px',
    205. top : '0px',
    206. left : '0px'
    207. });
    208. }
    209. //get dimentions of the image, 
    210. //in order to make it full size and centered
    211. function getImageDim($img){
    212. var w_w = jQuery(window).width(),
    213. w_h = jQuery(window).height(),
    214. r_w = w_h / w_w,
    215. i_w = $img.width(),
    216. i_h = $img.height(),
    217. r_i = i_h / i_w,
    218. new_w,new_h,
    219. new_left,new_top;
    220. if(r_w > r_i){
    221. new_h = w_h;
    222. new_w = w_h / r_i;
    223. }
    224. else{
    225. new_h = w_w * r_i;
    226. new_w = w_w;
    227. }


    228. return {
    229. width : new_w + 'px',
    230. height : new_h + 'px',
    231. left : (w_w - new_w) / 2 + 'px',
    232. top : (w_h - new_h) / 2 + 'px'
    233. };
    234. }
    235. });
    236.         </script>