From f73e474b3cf483d5e89041aceacbf46f07c6bde8 Mon Sep 17 00:00:00 2001 From: Sangjin Lim Date: Sat, 5 May 2012 17:26:15 +0900 Subject: [PATCH] Added direction:'fade' An animation for fade-in-out --- common/js/jqgalscroll.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/common/js/jqgalscroll.js b/common/js/jqgalscroll.js index 3364f31..c28a730 100644 --- a/common/js/jqgalscroll.js +++ b/common/js/jqgalscroll.js @@ -77,10 +77,12 @@ width = el.opts.width; height = el.totalChildren *el.opts.height; break; - default: + case 'diagonal': width = el.totalChildren *el.opts.width; height = el.totalChildren *el.opts.height; break; + default: + break; }; el.container = $('
').css({position:'relative'}); @@ -115,7 +117,12 @@ params = {right:(el.opts.width*href)} }; - el.jqthis.stop().animate(params,el.opts.speed, el.opts.ease); + if( el.opts.direction == 'fade'){ + el.jqthis.stop().fadeOut().animate(params,el.opts.speed, el.opts.ease).fadeIn(); + } + else{ + el.jqthis.stop().animate(params,el.opts.speed, el.opts.ease); + } index = href; return false; }); @@ -130,11 +137,11 @@ pos.x = j * el.opts.width; pos.y = j * el.opts.height; } - else if( el.opts.direction == 'horizontal'){ - pos.x = j * el.opts.width; - } else if( el.opts.direction == 'vertical'){ pos.y = j * el.opts.height; + } + else{ + pos.x = j * el.opts.width; }; var jqchild = $(this).css({height:el.opts.height,width:el.opts.width,position:'absolute',left:pos.x, top:pos.y});