Hello All,

I am relatively new to jquery but I have been charged at work to write
a plugin for an AJAX news Ticker.

I have had problems with the ticker animating. It runs correctly the
first three cycles, but then the fourth cycle no longer animates. My
code up to this point is here:

http://aboutbq.com/test/ticker/

I'm not sure what the issue is. The function which does the animation
is still being called because the ajax data continues to be updated.
But the animation no longer runs. I suspect there is some kind of
memory leak.

My code looks like this:
jQuery.fn.initTicker = function(){
        return this.each(function(){
                        $self = jQuery(this);

                        //find ul width:
                        tickerscrollW = $self.width();
                                jQuery("#ticker").html(tickerscrollW);
                        var parentW = 0;
                        parentW = 500;
                                jQuery("#parent").html(parentW);
                        //alert("Parent Element\n\n#tickerwrapper
width: " + parentW);
                        $self.css({
                                position: "relative",
                                left: parentW/2
                        });
                        $self.animate({
                                        left: 0
                                },
                                2000,
                                "linear",
                                function(){
                                        $.get("data.php", function
(data){
                                                jQuery
("#alertsub").html(data);
                                                $self.find("li").each
(function(){
                                                        jQuery
(this).html(data);
                                                });
                                        });
                                        $self.ajaxComplete(function(){
                                                $self.initTicker();
                                        });
                                }
                        );

        });
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
$(function(){
        $("#tickerscroll").initTicker();
});

If anyone can help it would be much appreciated.

bq

Reply via email to