ÿþ/ * *  
   *   L a v a L a m p   -   A   m e n u   p l u g i n   f o r   j Q u e r y   w i t h   c o o l   h o v e r   e f f e c t s .  
   *   @ r e q u i r e s   j Q u e r y   v 1 . 1 . 3 . 1   o r   a b o v e  
   *  
   *   h t t p : / / g m a r w a h a . c o m / b l o g / ? p = 7  
   *  
   *   C o p y r i g h t   ( c )   2 0 0 7   G a n e s h j i   M a r w a h a   ( g m a r w a h a . 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   a n d   G P L   l i c e n s e s :  
   *   h t t p : / / w w w . o p e n s o u r c e . o r g / l i c e n s e s / m i t - l i c e n s e . p h p  
   *   h t t p : / / w w w . g n u . o r g / l i c e n s e s / g p l . h t m l  
   *  
   *   V e r s i o n :   0 . 2 . 0  
   *   R e q u i r e s   J q u e r y   1 . 2 . 1   f r o m   v e r s i o n   0 . 2 . 0   o n w a r d s .    
   *   F o r   j q u e r y   1 . 1 . x ,   u s e   v e r s i o n   0 . 1 . 0   o f   l a v a l a m p  
   * /  
  
 / * *  
   *   C r e a t e s   a   m e n u   w i t h   a n   u n o r d e r e d   l i s t   o f   m e n u - i t e m s .   Y o u   c a n   e i t h e r   u s e   t h e   C S S   t h a t   c o m e s   w i t h   t h e   p l u g i n ,   o r   w r i t e   y o u r   o w n   s t y l e s    
   *   t o   c r e a t e   a   p e r s o n a l i z e d   e f f e c t  
   *  
   *   T h e   H T M L   m a r k u p   u s e d   t o   b u i l d   t h e   m e n u   c a n   b e   a s   s i m p l e   a s . . .  
   *  
   *               < u l   c l a s s = " l a v a L a m p " >  
   *                       < l i > < a   h r e f = " # " > H o m e < / a > < / l i >  
   *                       < l i > < a   h r e f = " # " > P l a n t   a   t r e e < / a > < / l i >  
   *                       < l i > < a   h r e f = " # " > T r a v e l < / a > < / l i >  
   *                       < l i > < a   h r e f = " # " > R i d e   a n   e l e p h a n t < / a > < / l i >  
   *               < / u l >  
   *  
   *   O n c e   y o u   h a v e   i n c l u d e d   t h e   s t y l e   s h e e t   t h a t   c o m e s   w i t h   t h e   p l u g i n ,   y o u   w i l l   h a v e   t o   i n c l u d e    
   *   a   r e f e r e n c e   t o   j q u e r y   l i b r a r y ,   e a s i n g   p l u g i n ( o p t i o n a l )   a n d   t h e   L a v a L a m p ( t h i s )   p l u g i n .  
   *  
   *   U s e   t h e   f o l l o w i n g   s n i p p e t   t o   i n i t i a l i z e   t h e   m e n u .  
   *       $ ( f u n c t i o n ( )   {   $ ( " . l a v a L a m p " ) . l a v a L a m p ( {   f x :   " b a c k o u t " ,   s p e e d :   7 0 0 } )   } ) ;  
   *  
   *   T h a t s   i t .   N o w   y o u   s h o u l d   h a v e   a   w o r k i n g   l a v a l a m p   m e n u .    
   *  
   *   @ p a r a m   a n   o p t i o n s   o b j e c t   -   Y o u   c a n   s p e c i f y   a l l   t h e   o p t i o n s   s h o w n   b e l o w   a s   a n   o p t i o n s   o b j e c t   p a r a m .  
   *  
   *   @ o p t i o n   f x   -   d e f a u l t   i s   " l i n e a r "  
   *   @ e x a m p l e  
   *   $ ( " . l a v a L a m p " ) . l a v a L a m p ( {   f x :   " b a c k o u t "   } ) ;  
   *   @ d e s c   C r e a t e s   a   m e n u   w i t h   " b a c k o u t "   e a s i n g   e f f e c t .   Y o u   n e e d   t o   i n c l u d e   t h e   e a s i n g   p l u g i n   f o r   t h i s   t o   w o r k .  
   *  
   *   @ o p t i o n   s p e e d   -   d e f a u l t   i s   5 0 0   m s  
   *   @ e x a m p l e  
   *   $ ( " . l a v a L a m p " ) . l a v a L a m p ( {   s p e e d :   5 0 0   } ) ;  
   *   @ d e s c   C r e a t e s   a   m e n u   w i t h   a n   a n i m a t i o n   s p e e d   o f   5 0 0   m s .  
   *  
   *   @ o p t i o n   c l i c k   -   n o   d e f a u l t s  
   *   @ e x a m p l e  
   *   $ ( " . l a v a L a m p " ) . l a v a L a m p ( {   c l i c k :   f u n c t i o n ( e v e n t ,   m e n u I t e m )   {   r e t u r n   f a l s e ;   }   } ) ;  
   *   @ d e s c   Y o u   c a n   s u p p l y   a   c a l l b a c k   t o   b e   e x e c u t e d   w h e n   t h e   m e n u   i t e m   i s   c l i c k e d .    
   *   T h e   e v e n t   o b j e c t   a n d   t h e   m e n u - i t e m   t h a t   w a s   c l i c k e d   w i l l   b e   p a s s e d   i n   a s   a r g u m e n t s .  
   * /  
 ( f u n c t i o n ( $ )   {  
 $ . f n . l a v a L a m p   =   f u n c t i o n ( o )   {  
         o   =   $ . e x t e n d ( {   f x :   " l i n e a r " ,   s p e e d :   5 0 0 ,   c l i c k :   f u n c t i o n ( ) { }   } ,   o   | |   { } ) ;  
  
         r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
                 v a r   m e   =   $ ( t h i s ) ,   n o o p   =   f u n c t i o n ( ) { } ,  
                         $ b a c k   =   $ ( ' < l i   c l a s s = " b a c k " > < d i v   c l a s s = " l e f t f a " > < / d i v > < / l i > ' ) . a p p e n d T o ( m e ) ,  
                         $ l i   =   $ ( " l i " ,   t h i s ) ,   c u r r   =   $ ( " l i . c u r r e n t " ,   t h i s ) [ 0 ]   | |   $ ( $ l i [ 0 ] ) . a d d C l a s s ( " c u r r e n t " ) [ 0 ] ;  
  
                 $ l i . n o t ( " . b a c k " ) . h o v e r ( f u n c t i o n ( )   {  
                         m o v e ( t h i s ) ;  
                 } ,   n o o p ) ;  
  
                 $ ( t h i s ) . h o v e r ( n o o p ,   f u n c t i o n ( )   {  
                         m o v e ( c u r r ) ;  
                 } ) ;  
  
                 $ l i . c l i c k ( f u n c t i o n ( e )   {  
                         s e t C u r r ( t h i s ) ;  
                         r e t u r n   o . c l i c k . a p p l y ( t h i s ,   [ e ,   t h i s ] ) ;  
                 } ) ;  
  
                 s e t C u r r ( c u r r ) ;  
  
                 f u n c t i o n   s e t C u r r ( e l )   {  
                         $ b a c k . c s s ( {   " l e f t " :   e l . o f f s e t L e f t + " p x " ,   " w i d t h " :   e l . o f f s e t W i d t h + " p x "   } ) ;  
                         c u r r   =   e l ;  
                 } ;  
  
                 f u n c t i o n   m o v e ( e l )   {  
                         $ b a c k . e a c h ( f u n c t i o n ( )   {  
                                 $ ( t h i s ) . d e q u e u e ( ) ;   }  
                         ) . a n i m a t e ( {  
                                 w i d t h :   e l . o f f s e t W i d t h ,  
                                 l e f t :   e l . o f f s e t L e f t  
                         } ,   o . s p e e d ,   o . f x ) ;  
                 } ;  
  
         } ) ;  
 } ;  
 } ) ( j Q u e r y ) ;  
 
