AJAX News Ticker Decay

jquery , news ticker , javascript , ajax Milwaukee, United States
  • 11 years ago

    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

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Never trust a programmer in a suit.” - Anonymous