New to jquery, suggestion needed.

New to jquery, suggestion needed.

Hi,

I am working on an RSS widget for one of my projects. I have managed to got my feed scrolling using jQuery, everything was working ok, but while doing minor adjustments I think I have messed up something and can't get it back to normal.

I have tried adding to "top" the height of the "li" item but it scrolls all the way down, over and over jumping all the content of the feed.

ex:

What am I missing?
Thanks!!!






  1. (function($){



  2. $.fn.vTicker = function(options) {

  3. var defaults = {

  4. speed: 700,

  5. pause: 4000,

  6. showItems: 3,

  7. animation: '',

  8. mousePause: true,

  9. isPaused: false

  10. };



  11. var options = $.extend(defaults, options);



  12. moveUp = function(obj2, height, paused){

  13. if(paused) return;


  14. var obj = obj2.children('ul');


  15.     first = obj.children('li:first').clone(true);


  16.     obj.animate({top: '-=' + height + 'px'}, options.speed, function() {

  17.         $(this).children('li:first').remove();

  18.         $(this).css('top', '0px');

  19.         });


  20. if(options.animation == 'fade') {

  21. obj.children('li:first').fadeOut(options.speed);

  22. obj.children('li:last').hide().fadeIn(options.speed);

  23. }



  24.     first.appendTo(obj);

  25. };


  26. return this.each(function() {

  27. var obj = $(this);

  28. var maxHeight = 0;

  29. var itempause = options.isPaused;


  30.                //obj.css({overflow: 'hidden', position: 'relative'})
  31.     obj.css({ position: 'relative'})
  32.    

  33. .children('ul').css({position: 'absolute', margin: 0, padding: 0})

  34. .children('li').css({margin: 0, padding: 0});



  35. obj.children('ul').children('li').each(function(){



  36. if($(this).height() > maxHeight) {

  37. maxHeight = $(this).height();

  38. }

  39. });



  40. obj.children('ul').children('li').each(function() {

  41. $(this).height(maxHeight);

  42. });



  43. obj.height(maxHeight * options.showItems);


  44.     var interval = setInterval(function(){ moveUp(obj, maxHeight, itempause); }, options.pause);


  45. if (options.mousePause)

  46. {

  47. obj.bind("mouseenter",function() {

  48. itempause = true;

  49. }).bind("mouseleave",function() {

  50. itempause = false;

  51. });

  52. }

  53. });

  54. };

  55. })(jQuery);