ÿþ/ *  
   *   	 E a s y   S l i d e r   1 . 5   -   j Q u e r y   p l u g i n  
   * 	 w r i t t e n   b y   A l e n   G r a k a l i c 	  
   * 	 h t t p : / / c s s g l o b e . c o m / p o s t / 4 0 0 4 / e a s y - s l i d e r - 1 5 - t h e - e a s i e s t - j q u e r y - p l u g i n - f o r - s l i d i n g  
   *  
   * 	 C o p y r i g h t   ( c )   2 0 0 9   A l e n   G r a k a l i c   ( h t t p : / / c s s g l o b e . c o m )  
   * 	 D u a l   l i c e n s e d   u n d e r   t h e   M I T   ( M I T - L I C E N S E . t x t )  
   * 	 a n d   G P L   ( G P L - L I C E N S E . t x t )   l i c e n s e s .  
   *  
   * 	 B u i l t   f o r   j Q u e r y   l i b r a r y  
   * 	 h t t p : / / j q u e r y . c o m  
   *  
   * /  
    
 / *  
   * 	 m a r k u p   e x a m p l e   f o r   $ ( " # s l i d e r " ) . e a s y S l i d e r ( ) ;  
   * 	  
   *   	 < d i v   i d = " s l i d e r " >  
   * 	 	 < u l >  
   * 	 	 	 < l i > < i m g   s r c = " i m a g e s / 0 1 . j p g "   a l t = " "   / > < / l i >  
   * 	 	 	 < l i > < i m g   s r c = " i m a g e s / 0 2 . j p g "   a l t = " "   / > < / l i >  
   * 	 	 	 < l i > < i m g   s r c = " i m a g e s / 0 3 . j p g "   a l t = " "   / > < / l i >  
   * 	 	 	 < l i > < i m g   s r c = " i m a g e s / 0 4 . j p g "   a l t = " "   / > < / l i >  
   * 	 	 	 < l i > < i m g   s r c = " i m a g e s / 0 5 . j p g "   a l t = " "   / > < / l i >  
   * 	 	 < / u l >  
   * 	 < / d i v >  
   *  
   * /  
  
 ( f u n c t i o n ( $ )   {  
  
 	 $ . f n . e a s y S l i d e r   =   f u n c t i o n ( o p t i o n s ) {  
 	      
 	 	 / /   d e f a u l t   c o n f i g u r a t i o n   p r o p e r t i e s  
 	 	 v a r   d e f a u l t s   =   { 	 	 	  
 	 	 	 p r e v I d :   	 	 ' p r e v B t n ' ,  
 	 	 	 p r e v T e x t :   	 	 ' Ö n c e k i ' ,  
 	 	 	 n e x t I d :   	 	 ' n e x t B t n ' , 	  
 	 	 	 n e x t T e x t :   	 	 ' S o n r a k i ' ,  
 	 	 	 c o n t r o l s S h o w : 	 t r u e ,  
 	 	 	 c o n t r o l s B e f o r e : 	 ' < d i v   i d = " c o n t r o l s " > ' ,  
 	 	 	 c o n t r o l s A f t e r : 	 ' < / d i v > ' , 	  
 	 	 	 c o n t r o l s F a d e : 	 t r u e ,  
 	 	 	 f i r s t I d :   	 	 ' f i r s t B t n ' ,  
 	 	 	 f i r s t T e x t :   	 	 ' F i r s t ' ,  
 	 	 	 f i r s t S h o w : 	 	 f a l s e ,  
 	 	 	 l a s t I d :   	 	 ' l a s t B t n ' , 	  
 	 	 	 l a s t T e x t :   	 	 ' L a s t ' ,  
 	 	 	 l a s t S h o w : 	 	 f a l s e , 	 	 	 	  
 	 	 	 v e r t i c a l : 	 	 f a l s e ,  
 	 	 	 s p e e d :   	 	 	 6 0 0 ,  
 	 	 	 a u t o : 	 	 	 f a l s e ,  
 	 	 	 p a u s e : 	 	 	 5 0 0 0 ,  
 	 	 	 c o n t i n u o u s : 	 	 f a l s e  
 	 	 } ;    
 	 	  
 	 	 v a r   o p t i o n s   =   $ . e x t e n d ( d e f a u l t s ,   o p t i o n s ) ;      
 	 	 	 	  
 	 	 t h i s . e a c h ( f u n c t i o n ( )   {      
 	 	 	 v a r   o b j   =   $ ( t h i s ) ;   	 	 	 	  
 	 	 	 v a r   s   =   $ ( " l i " ,   o b j ) . l e n g t h ;  
 	 	 	 v a r   w   =   $ ( " l i " ,   o b j ) . w i d t h ( ) ;    
 	 	 	 v a r   h   =   $ ( " l i " ,   o b j ) . h e i g h t ( ) ;    
 	 	 	 o b j . w i d t h ( w ) ;    
 	 	 	 o b j . h e i g h t ( h ) ;    
 	 	 	 o b j . c s s ( " o v e r f l o w " , " h i d d e n " ) ;  
 	 	 	 v a r   t s   =   s - 1 ;  
 	 	 	 v a r   t   =   0 ;  
 	 	 	 $ ( " u l " ,   o b j ) . c s s ( ' w i d t h ' , s * w ) ; 	 	 	  
 	 	 	 i f ( ! o p t i o n s . v e r t i c a l )   $ ( " l i " ,   o b j ) . c s s ( ' f l o a t ' , ' l e f t ' ) ;  
 	 	 	  
 	 	 	 i f ( o p t i o n s . c o n t r o l s S h o w ) {  
 	 	 	 	 v a r   h t m l   =   o p t i o n s . c o n t r o l s B e f o r e ;  
 	 	 	 	 i f ( o p t i o n s . f i r s t S h o w )   h t m l   + =   ' < s p a n   i d = " ' +   o p t i o n s . f i r s t I d   + ' " > < a   h r e f = \ " j a v a s c r i p t : v o i d ( 0 ) ; \ " > ' +   o p t i o n s . f i r s t T e x t   + ' < / a > < / s p a n > ' ;  
 	 	 	 	 h t m l   + =   '   < s p a n   i d = " ' +   o p t i o n s . p r e v I d   + ' " > < a   h r e f = \ " j a v a s c r i p t : v o i d ( 0 ) ; \ " > ' +   o p t i o n s . p r e v T e x t   + ' < / a > < / s p a n > ' ;  
 	 	 	 	 h t m l   + =   '   < s p a n   i d = " ' +   o p t i o n s . n e x t I d   + ' " > < a   h r e f = \ " j a v a s c r i p t : v o i d ( 0 ) ; \ " > ' +   o p t i o n s . n e x t T e x t   + ' < / a > < / s p a n > ' ;  
 	 	 	 	 i f ( o p t i o n s . l a s t S h o w )   h t m l   + =   '   < s p a n   i d = " ' +   o p t i o n s . l a s t I d   + ' " > < a   h r e f = \ " j a v a s c r i p t : v o i d ( 0 ) ; \ " > ' +   o p t i o n s . l a s t T e x t   + ' < / a > < / s p a n > ' ;  
 	 	 	 	 h t m l   + =   o p t i o n s . c o n t r o l s A f t e r ; 	 	 	 	 	 	  
 	 	 	 	 $ ( o b j ) . a f t e r ( h t m l ) ; 	 	 	 	 	 	 	 	 	 	  
 	 	 	 } ;  
 	  
 	 	 	 $ ( " a " , " # " + o p t i o n s . n e x t I d ) . c l i c k ( f u n c t i o n ( ) { 	 	  
 	 	 	 	 a n i m a t e ( " n e x t " , t r u e ) ;  
 	 	 	 } ) ;  
 	 	 	 $ ( " a " , " # " + o p t i o n s . p r e v I d ) . c l i c k ( f u n c t i o n ( ) { 	 	  
 	 	 	 	 a n i m a t e ( " p r e v " , t r u e ) ; 	 	 	 	  
 	 	 	 } ) ; 	  
 	 	 	 $ ( " a " , " # " + o p t i o n s . f i r s t I d ) . c l i c k ( f u n c t i o n ( ) { 	 	  
 	 	 	 	 a n i m a t e ( " f i r s t " , t r u e ) ;  
 	 	 	 } ) ; 	 	 	 	  
 	 	 	 $ ( " a " , " # " + o p t i o n s . l a s t I d ) . c l i c k ( f u n c t i o n ( ) { 	 	  
 	 	 	 	 a n i m a t e ( " l a s t " , t r u e ) ; 	 	 	 	  
 	 	 	 } ) ; 	 	  
 	 	 	  
 	 	 	 f u n c t i o n   a n i m a t e ( d i r , c l i c k e d ) {  
 	 	 	 	 v a r   o t   =   t ; 	 	 	 	  
 	 	 	 	 s w i t c h ( d i r ) {  
 	 	 	 	 	 c a s e   " n e x t " :  
 	 	 	 	 	 	 t   =   ( o t > = t s )   ?   ( o p t i o n s . c o n t i n u o u s   ?   0   :   t s )   :   t + 1 ; 	 	 	 	 	 	  
 	 	 	 	 	 	 b r e a k ;    
 	 	 	 	 	 c a s e   " p r e v " :  
 	 	 	 	 	 	 t   =   ( t < = 0 )   ?   ( o p t i o n s . c o n t i n u o u s   ?   t s   :   0 )   :   t - 1 ;  
 	 	 	 	 	 	 b r e a k ;    
 	 	 	 	 	 c a s e   " f i r s t " :  
 	 	 	 	 	 	 t   =   0 ;  
 	 	 	 	 	 	 b r e a k ;    
 	 	 	 	 	 c a s e   " l a s t " :  
 	 	 	 	 	 	 t   =   t s ;  
 	 	 	 	 	 	 b r e a k ;    
 	 	 	 	 	 d e f a u l t :  
 	 	 	 	 	 	 b r e a k ;    
 	 	 	 	 } ; 	  
 	 	 	 	  
 	 	 	 	 v a r   d i f f   =   M a t h . a b s ( o t - t ) ;  
 	 	 	 	 v a r   s p e e d   =   d i f f * o p t i o n s . s p e e d ; 	 	 	 	 	 	  
 	 	 	 	 i f ( ! o p t i o n s . v e r t i c a l )   {  
 	 	 	 	 	 p   =   ( t * w * - 1 ) ;  
 	 	 	 	 	 $ ( " u l " , o b j ) . a n i m a t e (  
 	 	 	 	 	 	 {   m a r g i n L e f t :   p   } ,    
 	 	 	 	 	 	 s p e e d  
 	 	 	 	 	 ) ; 	 	 	 	  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 p   =   ( t * h * - 1 ) ;  
 	 	 	 	 	 $ ( " u l " , o b j ) . a n i m a t e (  
 	 	 	 	 	 	 {   m a r g i n T o p :   p   } ,    
 	 	 	 	 	 	 s p e e d  
 	 	 	 	 	 ) ; 	 	 	 	 	  
 	 	 	 	 } ;  
 	 	 	 	  
 	 	 	 	 i f ( ! o p t i o n s . c o n t i n u o u s   & &   o p t i o n s . c o n t r o l s F a d e ) { 	 	 	 	 	  
 	 	 	 	 	 i f ( t = = t s ) {  
 	 	 	 	 	 	 $ ( " a " , " # " + o p t i o n s . n e x t I d ) . h i d e ( ) ;  
 	 	 	 	 	 	 $ ( " a " , " # " + o p t i o n s . l a s t I d ) . h i d e ( ) ;  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 $ ( " a " , " # " + o p t i o n s . n e x t I d ) . s h o w ( ) ;  
 	 	 	 	 	 	 $ ( " a " , " # " + o p t i o n s . l a s t I d ) . s h o w ( ) ; 	 	 	 	 	  
 	 	 	 	 	 } ;  
 	 	 	 	 	 i f ( t = = 0 ) {  
 	 	 	 	 	 	 $ ( " a " , " # " + o p t i o n s . p r e v I d ) . h i d e ( ) ;  
 	 	 	 	 	 	 $ ( " a " , " # " + o p t i o n s . f i r s t I d ) . h i d e ( ) ;  
 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 $ ( " a " , " # " + o p t i o n s . p r e v I d ) . s h o w ( ) ;  
 	 	 	 	 	 	 $ ( " a " , " # " + o p t i o n s . f i r s t I d ) . s h o w ( ) ;  
 	 	 	 	 	 } ; 	 	 	 	 	  
 	 	 	 	 } ; 	 	 	 	  
 	 	 	 	  
 	 	 	 	 i f ( c l i c k e d )   c l e a r T i m e o u t ( t i m e o u t ) ;  
 	 	 	 	 i f ( o p t i o n s . a u t o   & &   d i r = = " n e x t "   & &   ! c l i c k e d ) { ;  
 	 	 	 	 	 t i m e o u t   =   s e t T i m e o u t ( f u n c t i o n ( ) {  
 	 	 	 	 	 	 a n i m a t e ( " n e x t " , f a l s e ) ;  
 	 	 	 	 	 } , d i f f * o p t i o n s . s p e e d + o p t i o n s . p a u s e ) ;  
 	 	 	 	 } ;  
 	 	 	 	  
 	 	 	 } ;  
 	 	 	 / /   i n i t  
 	 	 	 v a r   t i m e o u t ;  
 	 	 	 i f ( o p t i o n s . a u t o ) { ;  
 	 	 	 	 t i m e o u t   =   s e t T i m e o u t ( f u n c t i o n ( ) {  
 	 	 	 	 	 a n i m a t e ( " n e x t " , f a l s e ) ;  
 	 	 	 	 } , o p t i o n s . p a u s e ) ;  
 	 	 	 } ; 	 	  
 	 	  
 	 	 	 i f ( ! o p t i o n s . c o n t i n u o u s   & &   o p t i o n s . c o n t r o l s F a d e ) { 	 	 	 	 	  
 	 	 	 	 $ ( " a " , " # " + o p t i o n s . p r e v I d ) . h i d e ( ) ;  
 	 	 	 	 $ ( " a " , " # " + o p t i o n s . f i r s t I d ) . h i d e ( ) ; 	 	 	 	  
 	 	 	 } ; 	 	 	 	  
 	 	 	  
 	 	 } ) ;  
 	      
 	 } ;  
  
 } ) ( j Q u e r y ) ;  
  
  
  
 
