Question

Hye,

Just a newbie trying to get something done and out of idea's I have a ul that is marqued from jquery function its marqueed left that means its sliding left what I want to do is to make it slide top

i Have made a working fiddle here

http://jsfiddle.net/arafays/wnXh8/

(function($)
{
 var methods = 
   {
     init : function( options ) 
     {
       return this.each(function()
         {
           var _this=$(this);
               _this.data('marquee',options);
           var _li=$('>li',_this);

               _this.wrap('<div class="slide_container"></div>')
                    .height(_this.height())
                   .hover(function(){if($(this).data('marquee').stop){$(this).stop(true,false);}},
                          function(){if($(this).data('marquee').stop){$(this).marquee('slide');}})
                    .parent()
                    .css({position:'relative',overflow:'hidden','height':$('>li',_this).height()})
                    .find('>ul')
                    .css({width:screen.width*2,position:'relative'});

               for(var i=0;i<Math.ceil((screen.width*3)/_this.width());++i)
               {
                 _this.append(_li.clone());
               } 

           _this.marquee('slide');});
     },

     slide:function()
     {
       var $this=this;
       $this.animate({'left':$('>li',$this).width()*-1},
                     $this.data('marquee').duration,
                     'swing',
                     function()
                     {
                       $this.css('left',0).append($('>li:first',$this));
                       $this.delay($this.data('marquee').delay).marquee('slide');

                     }
                    );

     }
   };

 $.fn.marquee = function(m) 
 {
   var settings={
                 'delay':4000,
                 'duration':2000,
                 'stop':true
                };

   if(typeof m === 'object' || ! m)
   {
     if(m){ 
     $.extend( settings, m );
   }

     return methods.init.apply( this, [settings] );
   }
   else
   {
     return methods[m].apply( this);
   }
 };
}
)( jQuery );


  jQuery(document).ready(
function(){jQuery('.some ul').marquee({delay:3000});}
  );

I just want to make it slide up instead of sliding left I tried making append top and doing some other some stuff but its making full ul slide up leaving blank space

Was it helpful?

Solution

Like this?

http://jsfiddle.net/wnXh8/5/

$this.animate({'top':$('>li',$this).height()*-1},
                       $this.data('marquee').duration,
                     'swing',
                     function()
                     {
                       $this.css('top',0).append($('>li:first',$this));
                       $this.delay($this.data('marquee').delay).marquee('slide');

                     }
                    );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top